/* Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to
in writing, software distributed under the License is
distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the
AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*
*
* This is js file is used to
* add the generic javascripts for the components
* hero banner
* blade image moble view.
* Also js to make teaser component clickable.
* The code is specific to redesign2020 code base.
*
*/
/* update the dynamic header to the function */
/*IE11 POLYFILL for "endswith" */
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (searchString, position) {
/* get search string */
const subjectString = this.toString();
if (
typeof position !== 'number' ||
!isFinite(position) ||
Math.floor(position) !== position ||
position > subjectString.length
) {
position = subjectString.length;
}
position -= searchString.length;
/* get last Index of subject string */
const lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
function updatedynamicheader() {
const dh_container = $('.dynamic_header > .cmp-container');
/*this checks if there is a dynamic header class */
if (dh_container.length > 0) {
var dh_height = 0;
dh_container.each(function () {
const dh_id = $(this).attr('id');
dh_height = dh_id.split('-')[1];
$(this).children('.aem-Grid').css('height', dh_height);
});
}
}
/* we need to move the active link in the international mobile navigation - start*/
function moveactive() {
$(
'.mobile__only.mobile__drawer .audience > .cmp-navigation > .cmp-navigation__group > .cmp-navigation__item--active'
)
.remove()
.appendTo(
$(
'.mobile__only.mobile__drawer .audience > .cmp-navigation > .cmp-navigation__group'
)
);
}
/* we need to move the active link in the international mobile navigation - end*/
$(document).ready(function () {
updatedynamicheader();
updateHeroForm();
updateCustomForm();
/* code to open external links in a new window starts */
$(
'.accordion,.button,.carousel,.container,.list,.navigation,.text,.title,.teaser,.teaserflex,.tabs,.image'
).each(function () {
if ($(this).hasClass('external-link')) {
$(this)
.find('a')
.each(function () {
const hostName = new RegExp('/' + window.location.host + '/');
const $this = $(this);
const alink = $this.prop('href');
const aLinkAttr = $this.attr('href');
const damlink = '/content/dam';
const testdamlink = this.href.indexOf(damlink) > -1;
if (
(!hostName.test(alink) &&
aLinkAttr &&
!alink.match(/^[mailto|tel|javascript:void]/)) ||
testdamlink
) {
$this.addClass('external-link');
$this.attr('title', $(this).text());
$this.append('external_link');
$this.attr('target', '_blank').attr('rel', 'noopener noreferrer');
}
});
/* code to remove external link icon to image starts*/
$(
".image a span[class^='custom-icons']:contains('external_link')"
).remove();
$(
".teaser .cmp-teaser__title a span[class^='custom-icons']:contains('external_link')"
).remove();
/* code to remove external link icon to image end */
}
});
/* code to open external links in a new window end */
/* Code to add rel="noopener noreferrer" to all external links with target _blank attr - Start */
$(
'a[href][target]:not([href^="tel:"],[href^="#"],[href^="mailto:"],[href^="javascript:"])'
).prop('rel', 'noopener noreferrer');
/* Code to add rel="noopener noreferrer" to all external links with target _blank attr - End */
if ($('#dmp-forms-VALIC').length > 0) {
const url = $('#dmp-forms-VALIC input[name = ":redirect"]')
.val()
.split('.html');
$('#dmp-forms-VALIC').attr('action', url[0]);
}
if ($('#dmp-forms-sponsorfit').length > 0) {
const url1 = $('#dmp-forms-sponsorfit input[name = ":redirect"]')
.val()
.split('.html');
$('#dmp-forms-sponsorfit').attr('action', url1[0]);
}
/* Code block to append blade image component - start */
$('.blade-with-image').each(function () {
const baldeteaser = $(this)
.children('.cmp-container')
.find('.aem-Grid')
.html();
$(this).append(baldeteaser);
});
//we need to make sure we are on the new nav
/* sticky naviagtion mobile view */
if ($('.sticky_nav').length) {
if ($('.header__bar').length) {
$(mobilStickyNav).insertAfter('.header__bar');
} else {
$(mobilStickyNav).insertAfter('.hamburg');
}
const $baseEdit = $('.sticky_nav .button:first a .cmp-button__text').text();
if ($('#edit-base').length) {
$('#edit-base').html($baseEdit);
}
const mobstickylinks = $('.sticky_nav .cmp-container').html();
$('.mob-sticky-nav').append(mobstickylinks);
$('.mobilestickynav .mob-sticky-nav .button .cmp-button').removeAttr('id');
$('.mob-sticky-nav').children().removeAttr('id');
}
$('.navigation-wrapper').click(function () {
$('.mob-sticky-nav').show();
$('.modal-header').show();
$('.header-stickynavpan').hide();
});
$('.close-icon').click(function (e) {
e.preventDefault();
$('.header-stickynavpan').show();
$('.mob-sticky-nav').hide();
$('.modal-header').hide();
});
/* sticky navigtion mobile view - end*/
/* Teaser title link check and update title link starts */
if ($('.cmp-teaser').length > 0) {
$('.cmp-teaser').each(function () {
if (
!$(this).find('.cmp-teaser__title a').length &&
$(this).find('.cmp-teaser__action-container a').length
) {
const linkVal = $(this)
.find('.cmp-teaser__action-container a')
.attr('href');
$(this)
.find('.cmp-teaser__title')
.wrapInner(
''
);
}
});
}
/* Teaser title link check and update title link ends */
/* Social media component mail show hide js starts */
$('.sharing .sharethis .email a').click(function () {
$('.sharing .sharethis .email-modal').show();
});
$('.sharing .sharethis .email-modal-body button.close').click(function () {
$('.sharing .sharethis .email-modal').hide();
});
/* Social media component mail show hide js end */
});
/*update the height of the header on resize. should add a debounce here */
$(window).on('resize', function () {
updatedynamicheader();
updateHeroForm();
updateCustomForm();
});
$(window).on('resize', function () {
updateHeroForm();
});
/* Sticky Navigation script - Start */
$(window).scroll(function () {
const stickyNavigation = $('.sticky_nav');
if (
stickyNavigation.length &&
($('.pre-footer').length || $('footer').length)
) {
const footerName = $('.pre-footer').length ? '.pre-footer' : 'footer';
const stickyNav = stickyNavigation.offset().top;
const stickyNavHeight = stickyNavigation.height();
onScrollUpdatePosition(
$(this).scrollTop(),
footerName,
'.sticky_nav .cmp-container',
stickyNav,
stickyNavHeight
);
}
});
/* Perform click action for sticky_nav: desktop - Start*/
$('.sticky_nav .cmp-container .button').click(function () {
const linkId = $(this).find('.cmp-button').attr('href');
if(linkId.indexOf('flyout-dialog') === -1){
onScrollUpdatePosition(
$(linkId).offset().top,
'.sticky_nav',
'.sticky_nav .cmp-container'
);
stickyNavTraverse(linkId, false);
}
});
/* Perform click action for sticky_nav: desktop - End*/
/* Perform click action for sticky_nav: mobile - Start*/
$(document).on('click', '.modal-dialog .mob-sticky-nav .button', function () {
const linkId = $(this).find('.cmp-button').attr('href');
onScrollUpdatePosition(
$(linkId).offset().top,
'.mob-sticky-nav',
'.mob-sticky-nav .cmp-container'
);
stickyNavTraverse(linkId, true);
});
/* Perform click action for sticky_nav: mobile - End*/
/* Method to set fixed position for sticky_nav & sticky_nav aig_button : on scroll action - Start*/
function onScrollUpdatePosition(
scrollTopPos,
stickyElementClass,
navElementClass,
sideNavTopPosition,
sideNavHeight
) {
let stickyDivTopPosition = 0;
if ($(stickyElementClass).length) {
stickyDivTopPosition = $(stickyElementClass).offset().top;
}
if (
(scrollTopPos > stickyDivTopPosition &&
stickyElementClass === '.sticky_nav_jp') ||
(scrollTopPos > sideNavTopPosition &&
scrollTopPos + sideNavHeight < stickyDivTopPosition)
) {
$(navElementClass).addClass('affix');
} else {
$(navElementClass).removeClass('affix');
}
if ($(window).width() > 641 && stickyElementClass !== '.sticky_nav_jp') {
if (
(scrollTopPos > stickyDivTopPosition &&
stickyElementClass === '.sticky_nav') ||
(scrollTopPos > sideNavTopPosition &&
scrollTopPos + sideNavHeight < stickyDivTopPosition)
) {
$(navElementClass).addClass('affix');
} else {
$(navElementClass).removeClass('affix');
}
}
if ($(window).width() < 640) {
if (scrollTopPos > stickyDivTopPosition) {
$('.sticky_nav .cmp-container .aig_button').addClass('stick_bottom');
} else {
$('.sticky_nav .cmp-container .aig_button').removeClass('stick_bottom');
}
}
}
/* Method to set fixed position for sticky_nav & sticky_nav aig_button : on scroll action - End*/
/* Method to set window scroll position for sticky_nav & sticky_nav aig_button on click action - Start*/
function stickyNavTraverse(linkId, isMobile) {
const stickyNavHeight = isMobile
? 10
: $('.container.sticky_nav .cmp-container').height();
let posi;
if (isMobile) {
posi = $('.sticky_nav .cmp-container .aig_button.stick_bottom').length
? $(linkId).parent('.container').offset().top - stickyNavHeight
: $(linkId).parent('.container').offset().top;
} else {
posi = $('.sticky_nav .cmp-container.affix').length
? $(linkId).parent('.container').offset().top - stickyNavHeight
: $(linkId).parent('.container').offset().top;
}
$('html, body').animate(
{
scrollTop: posi
},
50
);
}
/* Method to set window scroll position for sticky_nav & sticky_nav aig_button on click action - End*/
/* sticky navigation end*/
function createCookie(location) {
//set cookie to the current active link.
const l = location;
const d = new Date();
d.setTime(d.getTime() + 90 * 24 * 60 * 60 * 1000);
const expiry = d.toUTCString();
//creating cookie with the index so that we can add that back to the correct location.
//document.cookie = 'activeLink=' + l + ';expires=' + expiry + ';path=/';
}
//the following code gets and then will set the cookie to display proper menu
//remove the cookie creation below. used only for dev
//
//document.cookie = "landingcookiepath=individual";
//check host
const hn = window.location.hostname;
const landingcookiepath = getCookie('landingcookiepath');
if (
$('#aig-interim').length > 0 &&
hn.endsWith('.com') &&
landingcookiepath.length > 0
) {
/* Condition to check for landingcookiepath value and assign menu class name */
$('.audience')
.children('nav')
.children('ul')
.children()
.each(function (index, item) {
if (
$(item)
.children('.cmp-navigation__item-link')
.attr('href')
.includes(landingcookiepath)
) {
$(item).addClass('cmp-navigation__item--active');
} else {
$(item).removeClass('cmp-navigation__item--active');
}
});
}
/* Start of setting up the latest active link to show for those pages where links are not active in menu */
function setActiveNav(){
// lets construct get active. then we convert to an array from get active so we can use the some loop
const getActive = $('.utility__bar .cmp-navigation__item--level-0:visible, .main__nav .cmp-navigation__item--level-0:visible');
const getMobileActive = $('.mobile__drawer .cmp-navigation__item--level-0');
//if no active link is found, we will update the first link to be active
let noactive = false;
/* Desktop Navigation starts */
if (getActive.length > 0) {
//loop through array to find the active link.
getActive.each(function (index, item) {
$(item).on('click',function(){
createCookie(index);
});
if ($(item).hasClass('cmp-navigation__item--active')) {
noactive = true;
createCookie(index);
//lets break out of the loop since we are done with it.
return item;
}
});
//this is used so that if the user lands on a utility link first
if (!noactive) {
//is there a cookie?
if (
document.cookie.split(';').some(function (item) {
return !item.trim().indexOf('activeLink=');
})
) {
const activeLink = document.cookie.replace(/(?:(?:^|.*;\s*)activeLink\s*\=\s*([^;]*).*$)|^.*$/, '$1');
if(activeLink < getActive.length){
getActive[activeLink].classList.add('cmp-navigation__item--active');
}else{
//Reset cookie and first item will be active link
getActive[0].classList.add('cmp-navigation__item--active');
createCookie(0);
}
} else {
//no need to write a cookie here. If they continue on, it will be written later.
getActive[0].classList.add('cmp-navigation__item--active');
createCookie(0);
}
}
} else {
/* Mobile Mode starts */
if (getMobileActive.length > 0) {
//loop through array to find the active link.
getMobileActive.each(function (index, item) {
$(item).on('click',function(){
createCookie(index);
});
if ($(item).hasClass('cmp-navigation__item--active')) {
noactive = true;
createCookie(index);
//lets break out of the loop since we are done with it.
return item;
}
});
//this is used so that if the user lands on a utility link first
if (!noactive) {
//is there a cookie?
if (
document.cookie.split(';').some(function (item) {
return !item.trim().indexOf('activeLink=');
})
) {
const activeLink = document.cookie.replace(/(?:(?:^|.*;\s*)activeLink\s*\=\s*([^;]*).*$)|^.*$/, '$1');
if(activeLink < getMobileActive.length){
getMobileActive[activeLink].classList.add('cmp-navigation__item--active');
}else{
//Reset cookie and first item will be active link
getMobileActive[0].classList.add('cmp-navigation__item--active');
createCookie(0);
}
} else {
//no need to write a cookie here. If they continue on, it will be written later.
getMobileActive[0].classList.add('cmp-navigation__item--active');
createCookie(0);
}
}
}
}
}
setActiveNav();
/** Code to move International Header mobile active element to the end so that the inactive items appear properly **/
moveactive();
/** Code to update annuities login component in desktop and mobile conditionally - start **/
function updateHeroForm() {
$('.hero-banner-full-container').each(function () {
const cmpContainer = $('.hero-banner-full-container .cmp-container');
/** Code to update annuities login component in mobile conditionally - start **/
if ($(window).width() < 768) {
const heroForm = cmpContainer.find('.hero-banner-form').html();
if (
$(this).find('.wrap-form form').length === 0 &&
cmpContainer.find('.hero-banner-form').length > 0
) {
$(this).append('
' + heroForm + '
');
$(this)
.children('.cmp-container')
.find('.hero-banner-form > form')
.remove();
$('form[name*="lnr_annuities_login"]').attr('action', '');
}
}
/** Code to update annuities login component in mobile conditionally - end **/
/** Code to update annuities login component in desktop & tablet conditionally - start **/
if ($(window).width() >= 768 && $(this).children('.cmp-container')) {
const heroForm =
$(this).children('.cmp-container').find('.hero-banner-form > form')
.length === 0
? $(this).find('.wrap-form').html()
: cmpContainer.find('.hero-banner-form').html();
if (
$(this).children('.cmp-container').find('.hero-banner-form > form')
.length === 0 &&
$(this).find('.wrap-form > form').length > 0
) {
$(this)
.children('.cmp-container')
.find('.hero-banner-form')
.html(heroForm);
$(this).children('.cmp-container').siblings('.wrap-form').remove();
$('form[name*="lnr_annuities_login"]').attr('action', '');
}
}
/** Code to update annuities login component in desktop & tablet conditionally - end **/
});
}
/** Code to update annuities login component in desktop/mobile conditionally - end **/
/** Code to create Custom Select Dropdown - start **/
function selectCustomDropdown() {
if ($('.custom-select').length) {
/* To implement Hide dropdown outside click */
hideSelectDDOutsideClick();
/* To implement Custom dropdown using Un-ordered list */
$('.custom-select .cmp-form-options--drop-down').each(function (e) {
if ($(this).closest('form').parent('.contact_form').length) {
return;
}
const selectElement = $('select', this);
const listItem = $('option', selectElement);
let selectPicker =
'';
selectElement.attr('tabindex', -1);
$(
''
)
.html($('option:selected', selectElement).text())
.appendTo($(this));
listItem.each(function () {
selectPicker += '- ' + $(this).text() + '
';
});
$(selectPicker).appendTo($(this));
$(this)
.find('label')
.attr('id', 'selectLabel' + e);
$(this)
.find('.select-holder')
.attr('id', 'holder' + e)
.attr(
'aria-labelledby',
$(this).find('label').attr('id') + ' holder' + e
).attr('aria-controls','select-picker' + e).attr('aria-activedescendant',' ');
$('.select-picker li:first', $(this))
.addClass('select-active')
.attr('aria-selected', true);
});
/* To implement trigger click function for Select button */
$(document).on(
'click',
'.custom-select .cmp-form-options--drop-down .select-holder',
function () {
if ($(this).closest('form').parent('.contact_form').length) {
return;
}
if(($(this).hasClass('select-arrow-active'))){
$('.custom-select .select-picker').addClass('select-hide');
$(this)
.removeClass('select-arrow-active')
.attr('aria-expanded', false);
}
else{
$(this).next('.select-picker').removeClass('select-hide');
$(this).addClass('select-arrow-active');
$(this).attr('aria-expanded', true);
}
}
);
/* To implement trigger click function for DropDown Item */
$(document).on(
'click',
'.custom-select .cmp-form-options--drop-down .select-picker li',
function () {
if ($(this).closest('form').parent('.contact_form').length) {
return;
}
const selectNative = $(this)
.closest('.cmp-form-options--drop-down')
.find('select');
const selectPicker = $(this)
.closest('.cmp-form-options--drop-down')
.find('ul');
const selectItemText = $(this).text();
selectNative.prop('selectedIndex', $(this).index()).trigger('change');
selectPicker
.prev('.select-holder')
.text(selectItemText)
.removeClass('select-arrow-active')
.attr('aria-expanded', false)
.end()
.addClass('select-hide');
$('li', selectPicker)
.removeClass('select-active')
.removeAttr('aria-selected');
$(this).addClass('select-active').attr('aria-selected', true);
}
);
/* To implement WAI for custom dropdown */
selectCustomDDKeypress();
}
}
function inputKeypress(x,e) {
const $target = x;
const $selectPicker = $target.next('.select-picker');
const $selectList = $selectPicker.find('li');
const $selectedListItem = $selectPicker.find('li.select-active');
const $selectedListItemFirst = $selectPicker.find('li:first');
const $selectedListItemLast = $selectPicker.find('li:last');
const selectActive = 'select-active';
if (
$selectPicker.hasClass('select-hide') &&
e.which !== 13 &&
e.which !== 32
) {
return;
}
// If key is Enter & Bar
if (e.which === 13 || e.which === 32) {
// alert('hi');
if ($selectPicker.hasClass('select-hide')) {
$selectPicker.removeClass('select-hide');
$(this).attr('aria-expanded', true);
// $('.aig-report-claim').find('.options.custom-select ul.select-picker li.select-active div.filterList input.filterText').focus();
// $('.why-aig-container').find('.options.custom-select ul.select-picker li.select-active div.filterList input.filterText').focus();
$selectedListItem.removeClass(selectActive).removeAttr('aria-selected');
$selectedListItemFirst.addClass(selectActive).attr('aria-selected', true);
// $('.aig-report-claim').find('.options.custom-select ul.select-picker li.select-active div.filterList input.filterText').focus();
} else {
$selectedListItem.trigger('click');
}
return false;
}
// If key is Escape of Tab
if (e.which === 27 || e.which === 9) {
$selectPicker.addClass('select-hide');
$(this).attr('aria-expanded', false);
}
if ($selectList && $selectList.length > 1) {
// If key is Down arrow
if (e.which === 40) {
if ($selectedListItemLast.hasClass(selectActive)) {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItemFirst
.addClass(selectActive)
.attr('aria-selected', true);
} else {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItem
.next()
.addClass(selectActive)
.attr('aria-selected', true);
}
return false;
}
// If key is Up arrow
if (e.which === 38) {
if ($selectedListItemFirst.hasClass(selectActive)) {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItemLast
.addClass(selectActive)
.attr('aria-selected', true);
} else {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItem
.prev()
.addClass(selectActive)
.attr('aria-selected', true);
}
return false;
}
}
}
/* To implement keypress function for the list and input */
function selectCustomDDKeypress() {
$(document).on('keydown', '.options.custom-select ul.select-picker li', function (e) {
const x= $(this).parents('.options.custom-select').find('.select-holder');
inputKeypress(x,e);
});
$(document).on('keydown', '.custom-select .select-holder', function (e) {
const x = $(this);
inputKeypress(x,e);
});
$(document).on('keydown', '.options.custom-select ul.select-picker li.select-active div.filterList input.filterText', function (e) {
const x= $(this).parents('.options.custom-select').find('.select-holder');
const $target = x;
const $selectPicker = $target.next('.select-picker');
const $selectList = $selectPicker.find('li');
const $selectedListItem = $selectPicker.find('li.select-active');
const $selectedListItemFirst = $selectPicker.find('li:first');
const $selectedListItemLast = $selectPicker.find('li:last');
const selectActive = 'select-active';
if (
$selectPicker.hasClass('select-hide') &&
e.which !== 13 &&
e.which !== 32
) {
return;
}
// If key is Enter & Bar
if (e.which === 13 || e.which === 32) {
if ($selectPicker.hasClass('select-hide')) {
$selectPicker.removeClass('select-hide');
$(this).attr('aria-expanded', true);
//$('.aig-report-claim').find('.options.custom-select ul.select-picker li.select-active div.filterList input.filterText').focus();
} else {
$selectedListItem.trigger('click');
}
return false;
}
// If key is Escape of Tab
if (e.which === 27 || e.which === 9) {
$selectPicker.addClass('select-hide');
$(this).attr('aria-expanded', false);
}
if ($selectList && $selectList.length > 1) {
// If key is Down arrow
if (e.which === 40) {
if ($selectedListItemLast.hasClass(selectActive)) {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItemFirst
.addClass(selectActive)
.attr('aria-selected', true);
} else {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItem
.next()
.addClass(selectActive)
.attr('aria-selected', true);
}
return false;
}
// If key is Up arrow
if (e.which === 38) {
if ($selectedListItemFirst.hasClass(selectActive)) {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItemLast
.addClass(selectActive)
.attr('aria-selected', true);
} else {
$selectedListItem
.removeClass(selectActive)
.removeAttr('aria-selected');
$selectedListItem
.prev()
.addClass(selectActive)
.attr('aria-selected', true);
}
return false;
}
}
});
}
function hideSelectDDOutsideClick() {
$(document).click(function (e) {
e.stopPropagation();
//check if the clicked area is dropDown or not
if ($('.custom-select').has(e.target).length === 0) {
hideCustomDropdown();
}
});
}
function hideCustomDropdown() {
$('.custom-select .select-picker').addClass('select-hide');
$('.custom-select .select-holder')
.removeClass('select-arrow-active')
.attr('aria-expanded', false);
}
function updateButtonActionURL() {
if ($('.custom-select + .button a.cmp-button').length) {
/* To implement trigger click function for button to redirect page */
$('.custom-select + .button a.cmp-button').each(function () {
const selectActionUrl = $(this)
.parent('.button')
.prev('.custom-select')
.find('select')
.val();
$(this).attr('href', selectActionUrl);
if (
selectActionUrl.indexOf('.pdf') !== -1 ||
$(this)[0].host !== window.location.host
) {
$(this).attr('target', '_blank').attr('rel', 'noopener noreferrer');
}
});
/* To getting dropdown links on Custom Dropdown
and assin links to read more button */
$(document).on(
'click',
'.custom-select .cmp-form-options--drop-down .select-picker li',
function () {
const selectNative = $(this)
.closest('.cmp-form-options--drop-down')
.find('select');
const selectButton = $(this)
.closest('.custom-select')
.next('.button')
.find('a.cmp-button');
if (!selectButton.length) {
return;
}
const selectActionUrl = selectNative.val();
selectButton
.attr('href', selectActionUrl);
if (
selectActionUrl.indexOf('.pdf') !== -1 ||
$(selectButton)[0].host !== window.location.host
) {
selectButton.attr('target', '_blank').attr('rel', 'noopener noreferrer');
} else {
selectButton.attr('target', '_self').removeAttr('rel');
}
}
);
}
}
function initInlineFormOptions() {
if ($('.inline_form').length) {
$('.inline_form .cmp-form-text input').each(function () {
$(this).attr('placeholder', $(this).prev('label').text());
});
/* To set 'touched' class to custom select field once choose the dropdown value */
$('.inline_form select').on('change', function () {
if ($(this).val()) {
$(this).next('.select-holder').addClass('touched');
} else {
$(this).next('.select-holder').removeClass('touched');
}
});
/* To set empty value to native select for HTML5 validation */
$('.inline_form .custom-select select').each(function () {
if ($.trim($(this).find('option:first').val()) === '#') {
$(this).find('option:first').val('');
}
});
}
}
$(function () {
/* To implementing Custom Select Dropdown */
selectCustomDropdown();
/* To implementing Hero Banner Dropdown with Link options */
updateButtonActionURL();
/* To implement Inline Form options */
initInlineFormOptions();
});
/** Code to create Custom Select Dropdown - end **/
/** Code to update malaysia dropdown form in desktop and mobile conditionally - start **/
function updateCustomForm() {
$('.container').each(function () {
const heroFormElement = $('.hero-banner-dropdown form');
const cmpContainer = $('.hero-banner-dropdown').parent().parent();
if ($(window).width() < 768) {
const heroForm = $(this).find('.hero-banner-dropdown').html();
const flag = $(this).has('.hero-banner-dropdown');
if (heroFormElement.length > 0 && flag.length) {
$('' + heroForm + '
').insertAfter(
cmpContainer
);
$(this)
.children('.cmp-container')
.find('.hero-banner-dropdown form')
.remove();
}
}
/**Code to update malaysia dropdown form in desktop and mobile conditionally - start **/
if ($(window).width() >= 768) {
const heroForm =
$(this).children('.cmp-container').find('.hero-banner-dropdown form')
.length === 0
? $(this).find('.wrap-custom-form').html()
: cmpContainer.find('hero-banner-dropdown').html();
if ($(this).find('.wrap-custom-form > form').length > 0) {
$(this)
.children('.cmp-container')
.find('.hero-banner-dropdown')
.html(heroForm);
$(this)
.children('.cmp-container')
.siblings('.wrap-custom-form')
.remove();
}
}
/**Code to update malaysia dropdown form in desktop and mobile conditionally - end **/
});
}
/**Code to update video hero banner Autoplay - Start**/
$(document).ready(function () {
const vid = $('.hero-banner-full-container.video-hb .embed video');
vid.attr('loop', 'loop');
vid.prop('muted', true);
vid.prop('autoplay', true);
vid.prop('controls', false);
});
$(document).ready(function () {
const vid = $('.sixteennine__hero.vb .embed video');
vid.attr('loop', 'loop');
vid.prop('muted', true);
vid.prop('autoplay', true);
vid.prop('controls', false);
const vidid = document.querySelector(".vb .embed video");
$('.vb .button').on('click',function(){
if(vidid.paused){
vidid.play();
$('.vb .button button .cmp-button__icon').text('pause');
}
else{
vidid.pause();
$('.vb .button button .cmp-button__icon').text('play');
}
});
});
/**Code to update video hero banner Autoplay - end**/
/**code to update view more toggle. **/
$(document).ready(function () {
let showtext = $('.btn_show-hide .cmp-button__text').text();
let splitter = showtext.split(' ');
$('.btn_show-hide').click(function () {
$('.txt_show-hide').toggle('fast', function () {
if (splitter[0] === 'View') {
splitter[0] = 'Hide';
$('.btn_show-hide .cmp-button__text').text(splitter.join(' '));
$('.btn_show-hide .cmp-button__icon').text('chevron_down');
} else {
splitter[0] = 'View';
$('.btn_show-hide .cmp-button__text').text(splitter.join(' '));
$('.btn_show-hide .cmp-button__icon').text('chevron_up');
}
});
});
});
// lastModifiedDate format
$(document).ready(function () {
if($('div[class*="last-modified-"').length && $('#lastmodifiedDate').length){
let lmDate = new Date($('#lastmodifiedDate').val());
let lmGetDay = ("0"+(lmDate.getDate())).slice(-2);
let lmGetMonth = ("0"+(lmDate.getMonth()+1)).slice(-2);
let lmGetYear = lmDate.getFullYear();
let lmGetHours = ("0"+(lmDate.getHours())).slice(-2);
let lmGetMinutes = ("0"+(lmDate.getMinutes())).slice(-2);
let currentTimeZone = lmDate.toString().replace(/^.*GMT.*\(/, "").replace(/\)$/, "");
if(currentTimeZone.split(" ").length > 1){ currentTimeZone = currentTimeZone.match(/\b\w/g).join('');}
if($('.last-modified-mm-dd').length){
let $lastModified = $('.last-modified-mm-dd');
let lmText = $lastModified.text();
$lastModified.find('.cmp-text').html(lmText + ' '+ lmGetMonth +'/'+lmGetDay+'/'+lmGetYear+ ' '+lmGetHours+':'+lmGetMinutes+ ' '+currentTimeZone);
}
if($('.last-modified-dd-mm').length){
let $lastModified = $('.last-modified-dd-mm');
let lmText = $lastModified.text();
$lastModified.find('.cmp-text').html(lmText + ' '+ lmGetDay +'/'+lmGetMonth+'/'+lmGetYear+ ' '+lmGetHours+':'+lmGetMinutes+ ' '+currentTimeZone);
}
}
});
/* code for Decision Tree starts */
$(document).ready(function () {
/*check for the id starting with trigger-*/
if($('[id^="trigger-"]').length) {
/* when there is a click happened */
$('[id^="trigger-"]').click(function(e) {
e.preventDefault();
/* get id of the clicked div*/
const getId = $(this).attr('id');
const splitId = getId.split("trigger-");
/* hide the nearest container*/
$(this).closest('.container').addClass('hide').removeClass('show');
/* show the nearest container */
$('#' + splitId[1]).closest('.container').addClass('show').removeClass('hide');
});
}
});
/* code for Decision Tree ends */
/* Code to enable Print action for Page */
$(document).on('click', 'a[href="#print"]',function(e){
e.preventDefault();
window.print();
});
/* Code to enable Reset action for Form */
$(document).on('click', 'a[href="#reset"]',function(e){
e.preventDefault();
$(this).closest('form').get(0).reset();
});
/* Code to show Pop-up dialogue while navigating to external links--START */
$(document).ready(function () {
// To get dialog cookie
const isDialogCookie = getCookie('nocbfsplash') !== '' ? true : false;
if(!isDialogCookie){
//CoreBridge Popup checkbox
$('dialog .teaserflex').each(function(){
let desc = $(this).find('.cmp-teaser__action-container');
if($(this).parent().find('.container input[type="checkbox"]').length) {
$(this).parent().find('.container form').appendTo(desc);
$(this).find('.cmp-teaser__action-container').addClass('withCheckbox');
}
});
// Close dialog when click dialog action cta button
$('.container [id^=page-dialog] .teaserflex .cmp-teaser__action-link').click(
function () {
$(this).parents('dialog.container').removeClass('popup-dialog');
$('.open-popup').focus().attr({ tabindex: '0' }).removeClass('open-popup');
}
);
// To add click event for Continue button
$(document).on('click','.container [id^=page-dialog] .teaserflex .cmp-teaser__action-link:nth-child(2)',function(){
// Get modal cookie value
const noDialog = $(this).closest('.withCheckbox').find('input[name="nodialog"]:checked').val();
// To check whether cookie is set or not
if(noDialog){
const exdays = new Date();
exdays.setTime(exdays.getTime() + 90 * 24 * 60 * 60 * 1000);
document.cookie = 'nocbfsplash=true; expires='+ exdays;
// Reset link click event
$('a[href*="page-dialog"]').each(function () {
$(this).off('click').on('click');
});
// Remove hash query parameter
$('a[href*="#page-dialog"]').each(function () {
$(this).attr('href',$(this).attr('href').split('#')[0]);
});
}
});
// To add ARIA attributes when click the link
/* $('a[href*="page-dialog"]').each(function () {
const gethref = $(this).attr('href');
const splithref = gethref.split('#');
// To check query parameter
if(!$(this)[0].hash.substr(1)){
const vanityUrl = new URL(gethref);
if(vanityUrl.searchParams.get('modal')){
$(this).attr({'aria-controls': vanityUrl.searchParams.get('modal')});
}
}else{
$(this).attr({'aria-controls': splithref[1]});
}
}); */
//function on click of link with page-dialog
$('a[href*="page-dialog"]').click(function (e) {
const $this = $(this);
let target = '#'+$(this)[0].hash.substr(1);
const aLink = $this.prop('href');
// To check query parameter
const vanityUrl = new URL(aLink);
const vanityParams = vanityUrl.searchParams.get('modal');
if(vanityParams){
target = '#'+vanityParams;
// To avoid redirect page
$this.attr('href', 'javascript:;');
}
e.preventDefault();
$this.addClass('open-popup');
//if dialog has flex teaser, add class to its parent
if($(target).parent().find('.teaserflex').length){
$(target).parent().addClass('popup-dialog');
}
//if dialog has newsroom form, add class to its parent
if($(target).parent().find('.newsroom-form').length){
$(target).parent().addClass('popup-dialog');
}
//if dialog has dynamic media, add class to its parent
if($(target).parent().find('.dynamicmedia').length){
$(target).parent().addClass('popup-dialog');
}
// If have Video component on Hero banner
if($(target).parent().find('.videocomponent').length){
$(target).parent().find('.videocomponent .content__img-link').trigger('click');
}
$(target).parent().find('.teaserflex .cmp-teaser__action-link:nth-child(1)').attr('href', 'javascript:;');
//$(this).attr({ 'aria-haspopup': 'true', 'aria-expanded': 'true' });
$(target).not('[id^=page-dialog-footerlink]').parent().attr({ 'aria-modal': 'true' });
setTimeout(function () {
$(target).not('[id^=page-dialog-footerlink]').find('.cmp-teaser__action-container a:first').attr('tabindex', 0).focus();
if(vanityParams){ $this.attr('href', aLink);}
}, 200);
$(target).not('[id^=page-dialog-footerlink]').parent().find('.teaserflex .cmp-teaser__action-link:nth-child(1)').attr('aria-label', 'stay on same page');
$(target).not('[id^=page-dialog-footerlink]').parent().find('.teaserflex .cmp-teaser__action-link:nth-child(2)').attr('aria-label', 'you are leaving this website');
return false;
});
//To add event when leave the focus
$(document).on('focusout','.container [id^=page-dialog] .cmp-teaser__action-container a:last-child',function () {
if( $('.container [id^=page-dialog]:not([id^=page-dialog-footerlink]) .cmp-teaser__action-container a').length > 1){
$(this).closest('dialog').removeClass('popup-dialog').attr({ 'aria-expanded': 'false' });
$('.open-popup').focus().removeClass('open-popup');
}
});
// To add keyup event for the dialog buttons
$(document).on('keyup', '.container [id^=page-dialog] .cmp-teaser__action-container a',function (e) {
if (e.which === 27) {
$(this).closest('dialog').removeClass('popup-dialog').attr({ 'aria-expanded': 'false' });
$('.open-popup').focus().removeClass('open-popup');
}
}
);
} else {
// Remove hash query parameter
$('a[href*="#page-dialog"]').each(function () {
$(this).attr('href',$(this).attr('href').split('#')[0]);
});
}
});
/* Code to show Pop-up dialogue while navigating to external links--END */
/* code for internet explorer showing dialog box with message on loading --STARTS */
$(function () {
if (detectIE()) {
$('a[href="#page-dialog-ie"]').trigger('click');
}
});
function detectIE() {
const ua = window.navigator.userAgent;
const ie = ua.search(/MSIE \d|Trident.*rv:/);
return ie > -1;
}
/* code for internet explorer showing dialog box with message on loading --ENDS */
/*Copyright 2016 Adobe
Licensed under the Apache License,
Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,
Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*Javascript for cookie message
show and hide functionality*/
/*Cookie Message Starts*/
function readCookie(cname) {
const name = cname + '=';
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(name) !== -1) {
return c.substring(name.length, c.length);
}
}
return '';
}
if (window.location.pathname === '/' || window.location.pathname.length === 0) {
const cookieLastVisitedPath = readCookie('lastVisitedPath');
if (cookieLastVisitedPath !== undefined && cookieLastVisitedPath.length > 0) {
//Checking the cookie
const jcrPath = cookieLastVisitedPath.split('||')[0];
if (jcrPath !== undefined && jcrPath.length > 0) {
const jcrPathArray = jcrPath.split('/');
let newLocationURL = '';
for (let i = 6; i < jcrPathArray.length; i++) {
newLocationURL = newLocationURL + '/' + jcrPathArray[i];
}
const redirectPath = window.location.protocol + '//' + window.location.hostname + newLocationURL;
if (redirectPath !== undefined) {
window.location = encodeURI(redirectPath);
}
}
}
}
function getMsgCookie(name) {
const arg = name + '=';
const alen = arg.length;
const clen = document.cookie.length;
let i = 0;
while (i < clen) {
const j = i + alen;
if (document.cookie.substring(i, j) === arg) {
return 'here';
}
i = document.cookie.indexOf(' ', i) + 1;
if (i === 0) {
break;
}
}
return null;
}
function checkMsgCookie() {
const visit = getMsgCookie('MessageCookie');
let flag = true;
if (visit === null) {
document.cookie = 'MessageCookie=location.href;path=/;';
flag = false;
}
return flag;
}
function cookieCheckForYoutube() {
var cookieFlag = cookieConsentCheck(2);
//console.log(cookieFlag);
if(!cookieFlag){
$('a.video_thumbnail').each(function(e){
let videoSrc = $(this).attr('data-src');
//console.log("videoSrc - "+ videoSrc);
if(videoSrc.indexOf('youtube.com') != -1){
videoSrc = videoSrc.replace('youtube.com','youtube-nocookie.com');
$(this).attr('data-src',videoSrc);
}
});
$('.cmp-embed iframe').each(function(e){
let videoSrc = $(this).attr('src');
if(videoSrc.indexOf('youtube.com') != -1){
videoSrc = videoSrc.replace('youtube.com','youtube-nocookie.com');
$(this).attr('src',videoSrc);
}
});
}
}
function cookieConsentCheck(prefs_index) {
let cookieValue = getCookie("notice_gdpr_prefs");
//console.log(cookieValue);
if(cookieValue != undefined && cookieValue.length > 0){
if(cookieValue.indexOf(prefs_index) !== -1){
return true;
} else{
return false;
}
}else{
return true;
}
}
$(document).ready(function () {
$('#msg').hide();
let cookie;
if($('#cookie').length){
cookie = checkMsgCookie();
}
const divcookie = $('#cookie');
if (!cookie) {
divcookie.show();
divcookie.addClass('copyright-text-header');
if ($('#aigCookieMsg').length) {
document.getElementById('aigCookieMsg').innerHTML = $('#msg').html();
}
} else {
divcookie.hide();
}
$('.copyright-text-header .cookieclose').click(function () {
$('.copyright-text-header').hide();
});
cookieCheckForYoutube();
});
/*cookie Message Ends*/
/*Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group, Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
$('.emergency .emergencyclose').click(function() {
setCookie('emergencymsg', getCookie('emergencymsg') + '||closed', 30);
$('.emergency').hide();
});
/* Cookie Message Starts */
const mode = $('#mode').val();
let currentURL = location.protocol + '//' + location.host + location.pathname;
//Emergency Message cookie object
const emergencymsg = getCookie('emergencymsg');
//Emergency Message cookie value
let emergencyCookieValue = '';
//Emergency Message page URL
let emergencyMsgPageURL = '';
//Emergency Message String
let emergencyMsgString = '';
//Emergency Message BG Color
let emergencyMsgBgColor = '';
//Emergency Message Text Color
let emergencyMsgTextColor = '';
//String variable Emergency Message Opened/Closed
let emergencyClosed = '';
//Page Navigated Boolean Variable
let pageNavigated = '';
//Emergency Message Div Id
const emergencyids = $('#emergency');
/**
* If Emergency Message cookie object exists
* populate all variables with current values
* Also check if emergency message is in opened or closed state
* and set the appropriate value
*/
if (emergencymsg !== '') {
emergencyCookieValue = emergencymsg.split('||');
emergencyMsgPageURL = emergencyCookieValue[0];
pageNavigated = emergencyCookieValue[1];
emergencyMsgString = emergencyCookieValue[2];
emergencyMsgBgColor = emergencyCookieValue[3];
emergencyMsgTextColor = emergencyCookieValue[4];
if (typeof emergencyCookieValue[5] !== 'undefined') {
emergencyClosed = '||closed';
} else {
emergencyClosed = '';
}
}
/* checks whether mode is editmode or not */
if (mode !== 'editmode') {
checkCookie();
}
/*
This condition checks
whether author
is in editmode if yes
we will add css class before maindiv.
*/
if (mode === 'editmode') {
const copyRightTextHeader = $('.copyright-text-header');
const htmlString = copyRightTextHeader.html();
const emergencyString = $('#emergency').html();
const maindiv = "';
const emergencyIDsEdit = $('#emergency');
if (
typeof htmlString !== 'undefined' &&
typeof emergencyString !== 'undefined'
) {
emergencyIDsEdit.html('');
copyRightTextHeader.remove();
$('.container-fluid').before(
emergencyString + maindiv + htmlString + maindiv2
);
}
if (
typeof htmlString !== 'undefined' &&
typeof emergencyString === 'undefined'
) {
emergencyIDsEdit.html('');
copyRightTextHeader.remove();
$('.container-fluid').before(maindiv + htmlString + maindiv2);
}
}
/*
This method is
used to set
the cookie
in the browser.
*/
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
const expires = '';
document.cookie = cname + '=' + cvalue + '; ' + expires + ';path=/';
}
/*
This method is
used to get the cookie
from the browser
available cookies.
*/
function getCookie(cname) {
const name = cname + '=';
const ca = document.cookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
}
if (c.indexOf(name) !== -1) {
return c.substring(name.length, c.length);
}
}
return '';
}
/*
This method is
used to check whether
cookie is present
in the browser
or not.
*/
function checkCookie() {
if (emergencyids.length) {
currentURL = location.protocol + '//' + location.host + location.pathname;
let emrgncytext = emergencyids.find('.emergency').attr('data-modified');
const emrgncytextbgcolorclassname = $('.emergency').attr('class');
const emrgncytextbgcolorclass = emrgncytextbgcolorclassname.split(' ');
const emrgncytextbgcolor = emrgncytextbgcolorclass[1];
let emergencytextcolor = $('.emergency')[0].style.color;
const emergencyId = emergencyids.find('.emergency');
emrgncytext = encodeURIComponent(emrgncytext);
emergencytextcolor = encodeURIComponent(emergencytextcolor);
const msgAndUrl =
currentURL +
'||' +
'false' +
'||' +
emrgncytext +
'||' +
emrgncytextbgcolor +
'||' +
emergencytextcolor +
emergencyClosed;
if (emrgncytext !== '') {
if (
(checkEmergencyMsgString(emrgncytext) ||
checkEmergencyMsgBgColor(emrgncytextbgcolor, emergencytextcolor)) &&
checkEmergencyClosed()
) {
emergencyId.show();
delCookie('emergencymsg');
setCookie('emergencymsg', msgAndUrl, 30);
} else {
checkEmergencypageurl(currentURL, emergencyId);
}
} else {
emergencyId.hide();
}
}
}
/* checks emergency message string and returns boolean value accordingly */
function checkEmergencyMsgString(emrgncytext) {
let checkEmgyMsgBoolean = false;
if (emergencyMsgString === '' || emergencyMsgString !== emrgncytext) {
checkEmgyMsgBoolean = true;
}
return checkEmgyMsgBoolean;
}
/* checks emergency message backgroung color and returns boolean value accordingly */
function checkEmergencyMsgBgColor(emrgncytextbgcolor, emergencytextcolor) {
let checkEmgyMsgBgColrBoolean = false;
if (
emergencyMsgBgColor !== emrgncytextbgcolor ||
emergencyMsgTextColor !== emergencytextcolor
) {
checkEmgyMsgBgColrBoolean = true;
}
return checkEmgyMsgBgColrBoolean;
}
/* checks whether emergency message is closed and returns boolean value accordingly */
function checkEmergencyClosed() {
let checkEmgyClosedBoolean = false;
if (
emergencyClosed === '||closed' ||
emergencyClosed === '' ||
typeof emergencyClosed === 'undefined'
) {
checkEmgyClosedBoolean = true;
}
return checkEmgyClosedBoolean;
}
/*
This method is
used to check emergency page url
*/
function checkEmergencypageurl(currentURL, emergencyId) {
if (
emergencyMsgPageURL === currentURL &&
pageNavigated === 'false' &&
(emergencyClosed === '' || typeof emergencyClosed === 'undefined')
) {
emergencyId.show();
} else if (
emergencyMsgPageURL !== currentURL &&
pageNavigated === 'false' &&
(emergencyClosed === '' || typeof emergencyClosed === 'undefined')
) {
emergencyId.show();
} else {
emergencyId.hide();
delCookie('emergencymsg');
const newValueAfterNav =
emergencyMsgPageURL +
'||' +
'true' +
'||' +
emergencyMsgString +
'||' +
emergencyMsgBgColor +
'||' +
emergencyMsgTextColor +
emergencyClosed;
setCookie('emergencymsg', newValueAfterNav, 30);
}
}
/*
This method is
used to delete the cookie.
*/
function delCookie(name) {
document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;path=/';
}
/* Cookie Message Ends */
/**
* jQuery jPages v0.7
* Client side pagination with jQuery
* http://luis-almeida.github.com/jPages
*
* Licensed under the MIT license.
* Copyright 2012 LuÃs Almeida
* https://github.com/luis-almeida
*/
if($('.search-results-pan').length >=1) {
var prevSearchLbl = $('#previousLabel').val(),
nextSearchLbl = $('#nextLabel').val();
var prevSearchAlt = $('#prevSearchAlt').val(),
nextSearchAlt = $('#nextSearchAlt').val();
;(function($,window,document,undefined){var name="jPages",instance=null,defaults={containerID:"",first:false,previous:"‹ "+ prevSearchLbl,next: nextSearchLbl+ " ›",last:false,links:"numeric",startPage:1,perPage:10,midRange:5,startRange:1,endRange:1,keyBrowse:false,scrollBrowse:false,pause:0,clickStop:false,delay:50,direction:"forward",animation:"",fallback:400,minHeight:true,callback:undefined};function Plugin(element,options){this.options=$.extend({},defaults,options);this._container=$("#"+this.options.containerID);if(!this._container.length)return;this.jQwindow=$(window);this.jQdocument=$(document);this._holder=$(element);this._nav={};this._first=$(this.options.first);this._previous=$(this.options.previous);this._next=$(this.options.next);this._last=$(this.options.last);this._items=this._container.children(":visible");this._itemsShowing=$([]);this._itemsHiding=$([]);this._numPages=Math.ceil(this._items.length/this.options.perPage);this._currentPageNum=this.options.startPage;this._clicked=false;this._cssAnimSupport=this.getCSSAnimationSupport();this.init();}Plugin.prototype={constructor:Plugin,getCSSAnimationSupport:function(){var animation=false,animationstring='animation',keyframeprefix='',domPrefixes='Webkit Moz O ms Khtml'.split(' '),pfx='',elm=this._container.get(0);if(elm.style.animationName)animation=true;if(animation===false){for(var i=0;i";$(requiredStyles).appendTo("head");if(this._cssAnimSupport&&this.options.animation.length)this._items.addClass("animated jp-hidden");else this._items.hide();},setNav:function(){var navhtml=this.writeNav();this._holder.each(this.bind(function(index,element){var holder=$(element);holder.html(navhtml);this.cacheNavElements(holder,index);this.bindNavHandlers(index);this.disableNavSelection(element);},this));if(this.options.keyBrowse)this.bindNavKeyBrowse();if(this.options.scrollBrowse)this.bindNavScrollBrowse();},writeNav:function(){var i=1,navhtml;navhtml=this.writeBtn("first")+this.writeBtn("previous");for(;i<=this._numPages;i++){if(i===1&&this.options.startRange===0)navhtml+="...";if(i>this.options.startRange&&i<=this._numPages-this.options.endRange)navhtml+="";else
navhtml+="";switch(this.options.links){case"numeric":navhtml+=i;break;case"blank":break;case"title":var title=this._items.eq(i-1).attr("data-title");navhtml+=title!==undefined?title:"";break;}navhtml+="";if(i===this.options.startRange||i===this._numPages-this.options.endRange)navhtml+="...";}navhtml+=this.writeBtn("next")+this.writeBtn("last")+"";return navhtml;},writeBtn:function(which){if(which == 'previous') {return this.options[which]!==false&&!$(this["_"+which]).length?""+this.options[which]+"":"";}else if(which == 'next') {return this.options[which] !== false && !$(this["_" + which]).length ? "" + this.options[which] + "" : "";}else{return this.options[which] !== false && !$(this["_" + which]).length ? "" + this.options[which] + "" : "";}},cacheNavElements:function(holder,index){this._nav[index]={};this._nav[index].holder=holder;this._nav[index].first=this._first.length?this._first:this._nav[index].holder.find("a.jp-first");this._nav[index].previous=this._previous.length?this._previous:this._nav[index].holder.find("a.jp-previous");this._nav[index].next=this._next.length?this._next:this._nav[index].holder.find("a.jp-next");this._nav[index].last=this._last.length?this._last:this._nav[index].holder.find("a.jp-last");this._nav[index].fstBreak=this._nav[index].holder.find("span:first");this._nav[index].lstBreak=this._nav[index].holder.find("span:last");this._nav[index].pages=this._nav[index].holder.find("a").not(".jp-first, .jp-previous, .jp-next, .jp-last");this._nav[index].permPages=this._nav[index].pages.slice(0,this.options.startRange).add(this._nav[index].pages.slice(this._numPages-this.options.endRange,this._numPages));this._nav[index].pagesShowing=$([]);this._nav[index].currentPage=$([]);},bindNavHandlers:function(index){var nav=this._nav[index];nav.holder.bind("click.jPages",this.bind(function(evt){var newPage=this.getNewPage(nav,$(evt.target));if(this.validNewPage(newPage)){this._clicked=true;this.paginate(newPage);}evt.preventDefault();},this));if(this._first.length){this._first.bind("click.jPages",this.bind(function(){if(this.validNewPage(1)){this._clicked=true;this.paginate(1);}},this));}if(this._previous.length){this._previous.bind("click.jPages",this.bind(function(){var newPage=this._currentPageNum-1;if(this.validNewPage(newPage)){this._clicked=true;this.paginate(newPage);}},this));}if(this._next.length){this._next.bind("click.jPages",this.bind(function(){var newPage=this._currentPageNum+1;if(this.validNewPage(newPage)){this._clicked=true;this.paginate(newPage);}},this));}if(this._last.length){this._last.bind("click.jPages",this.bind(function(){if(this.validNewPage(this._numPages)){this._clicked=true;this.paginate(this._numPages);}},this));}},disableNavSelection:function(element){if(typeof element.onselectstart!="undefined")element.onselectstart=function(){return false;};else if(typeof element.style.MozUserSelect!="undefined")element.style.MozUserSelect="none";else
element.onmousedown=function(){return false;};},bindNavKeyBrowse:function(){this.jQdocument.bind("keydown.jPages",this.bind(function(evt){var target=evt.target.nodeName.toLowerCase();if(this.elemScrolledIntoView()&&target!=="input"&&target!="textarea"){var newPage=this._currentPageNum;if(evt.which==37)newPage=this._currentPageNum-1;if(evt.which==39)newPage=this._currentPageNum+1;if(this.validNewPage(newPage)){this._clicked=true;this.paginate(newPage);}}},this));},elemScrolledIntoView:function(){var docViewTop,docViewBottom,elemTop,elemBottom;docViewTop=this.jQwindow.scrollTop();docViewBottom=docViewTop+this.jQwindow.height();elemTop=this._container.offset().top;elemBottom=elemTop+this._container.height();return((elemBottom>=docViewTop)&&(elemTop<=docViewBottom));},bindNavScrollBrowse:function(){this._container.bind("mousewheel.jPages DOMMouseScroll.jPages",this.bind(function(evt){var newPage=(evt.originalEvent.wheelDelta||-evt.originalEvent.detail)>0?(this._currentPageNum-1):(this._currentPageNum+1);if(this.validNewPage(newPage)){this._clicked=true;this.paginate(newPage);}evt.preventDefault();return false;},this));},getNewPage:function(nav,target){if(target.is(nav.currentPage))return this._currentPageNum;if(target.is(nav.pages))return nav.pages.index(target)+1;if(target.is(nav.first))return 1;if(target.is(nav.last))return this._numPages;if(target.is(nav.previous))return nav.pages.index(nav.currentPage);if(target.is(nav.next))return nav.pages.index(nav.currentPage)+2;},validNewPage:function(newPage){return newPage!==this._currentPageNum&&newPage>0&&newPage<=this._numPages;},paginate:function(page){var itemRange,pageInterval;itemRange=this.updateItems(page);pageInterval=this.updatePages(page);this._currentPageNum=page;if($.isFunction(this.options.callback))this.callback(page,itemRange,pageInterval);this.updatePause();},updateItems:function(page){var range=this.getItemRange(page);this._itemsHiding=this._itemsShowing;this._itemsShowing=this._items.slice(range.start,range.end);if(this._cssAnimSupport&&this.options.animation.length)this.cssAnimations(page);else this.jQAnimations(page);return range;},getItemRange:function(page){var range={};range.start=(page-1)*this.options.perPage;range.end=range.start+this.options.perPage;if(range.end>this._items.length)range.end=this._items.length;return range;},cssAnimations:function(page){clearInterval(this._delay);this._itemsHiding.removeClass(this.options.animation+" jp-invisible").addClass("jp-hidden");this._itemsShowing.removeClass("jp-hidden").addClass("jp-invisible");this._itemsOriented=this.getDirectedItems(page);this._index=0;this._delay=setInterval(this.bind(function(){if(this._index===this._itemsOriented.length)clearInterval(this._delay);else{this._itemsOriented.eq(this._index).removeClass("jp-invisible").addClass(this.options.animation);}this._index=this._index+1;},this),this.options.delay);},jQAnimations:function(page){clearInterval(this._delay);this._itemsHiding.addClass("jp-hidden");this._itemsShowing.fadeTo(0,0).removeClass("jp-hidden");this._itemsOriented=this.getDirectedItems(page);this._index=0;this._delay=setInterval(this.bind(function(){if(this._index===this._itemsOriented.length)clearInterval(this._delay);else{this._itemsOriented.eq(this._index).fadeTo(this.options.fallback,1);}this._index=this._index+1;},this),this.options.delay);},getDirectedItems:function(page){var itemsToShow;switch(this.options.direction){case"backwards":itemsToShow=$(this._itemsShowing.get().reverse());break;case"random":itemsToShow=$(this._itemsShowing.get().sort(function(){return(Math.round(Math.random())-0.5);}));break;case"auto":itemsToShow=page>=this._currentPageNum?this._itemsShowing:$(this._itemsShowing.get().reverse());break;default:itemsToShow=this._itemsShowing;}return itemsToShow;},updatePages:function(page){var interval,index,nav;interval=this.getInterval(page);for(index in this._nav){if(this._nav.hasOwnProperty(index)){nav=this._nav[index];this.updateBtns(nav,page);this.updateCurrentPage(nav,page);this.updatePagesShowing(nav,interval);this.updateBreaks(nav,interval);}}return interval;},getInterval:function(page){var neHalf,upperLimit,start,end;neHalf=Math.ceil(this.options.midRange/2);upperLimit=this._numPages-this.options.midRange;start=page>neHalf?Math.max(Math.min(page-neHalf,upperLimit),0):0;end=page>neHalf?Math.min(page+neHalf-(this.options.midRange%2>0?1:0),this._numPages):Math.min(this.options.midRange,this._numPages);return{start:start,end:end};},updateBtns:function(nav,page){if(page===1){nav.first.addClass("jp-disabled");nav.previous.addClass("jp-disabled");}if(page===this._numPages){nav.next.addClass("jp-disabled");nav.last.addClass("jp-disabled");}if(this._currentPageNum===1&&page>1){nav.first.removeClass("jp-disabled");nav.previous.removeClass("jp-disabled");}if(this._currentPageNum===this._numPages&&pagethis.options.startRange||(this.options.startRange===0&&interval.start>0))nav.fstBreak.removeClass("jp-hidden");else nav.fstBreak.addClass("jp-hidden");if(interval.end1){clearTimeout(this._pause);if(this.options.clickStop&&this._clicked)return;else{this._pause=setTimeout(this.bind(function(){this.paginate(this._currentPageNum!==this._numPages?this._currentPageNum+1:1);},this),this.options.pause);}}},setMinHeight:function(){if(this.options.minHeight&&!this._container.is("table, tbody")){setTimeout(this.bind(function(){this._container.css({"min-height":this._container.css("height")});},this),1000);}},bind:function(fn,me){return function(){return fn.apply(me,arguments);};},destroy:function(){this.jQdocument.unbind("keydown.jPages");this._container.unbind("mousewheel.jPages DOMMouseScroll.jPages");if(this.options.minHeight)this._container.css("min-height","");if(this._cssAnimSupport&&this.options.animation.length)this._items.removeClass("animated jp-hidden jp-invisible "+this.options.animation);else this._items.removeClass("jp-hidden").fadeTo(0,1);this._holder.unbind("click.jPages").empty();}};$.fn[name]=function(arg){var type=$.type(arg);if(type==="object"){if(this.length&&!$.data(this,name)){instance=new Plugin(this,arg);this.each(function(){$.data(this,name,instance);});}return this;}if(type==="string"&&arg==="destroy"){instance.destroy();this.each(function(){$.removeData(this,name);});return this;}if(type==='number'&&arg%1===0){if(instance.validNewPage(arg))instance.paginate(arg);return this;}return this;};})(jQuery,window,document);
}
/*Copyright 2016 Adobe
*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group, Inc.
All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports
AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston
NJ 07039.
This file includes all the search result
pagination scripts
*/
/*
* This funciton is used in the search components
* which implement pagination, news, product search
* Ajax call which retrives partial search results.
* The code is being used from AIG international code base.
*
*/
$(document).ready(function() {
if ($('.search-results-pan').length >= 1) {
callJpages('div.holder', 'itemContainer', '#paginationText', '#legend2');
if ($('.search-results-content').length < 1) {
$('.search-results-pan .holder, #search-type-nav').css('display', 'none');
}
const setMinHeight = $('#search-type-nav.hidden-xs').outerHeight();
$('.search-results-content').css('min-height', setMinHeight);
}
});
function callJpages(holderId, containerId, paginationId, paginationDisplayer) {
$(holderId).jPages({
containerID: containerId,
perPage: 10,
keyBrowse: true,
scrollBrowse: false,
callback: function(b, a) {
const paginationCount = a.count <= 0 ? 0 : a.range.start,
currentSearchRange =
'' + paginationCount + '-' + a.range.end + '';
const totalSearchResults = '' + a.count + '';
const paginationTxt = $(paginationId).val()
? $(paginationId).val()
: $(paginationId).html(),
paginationTxt1 = paginationTxt.replace(
paginationTxt.substring(
paginationTxt.indexOf('{0', 0),
paginationTxt.indexOf('0}') + 2
),
currentSearchRange
),
finalOutputSearchResult = paginationTxt1.replace(
paginationTxt1.substring(
paginationTxt1.lastIndexOf('{1'),
paginationTxt1.lastIndexOf('1}') + 2
),
totalSearchResults
);
$(paginationDisplayer).html(finalOutputSearchResult);
}
});
}
/*Copyright 2016 Adobe
*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group, Inc.
All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the
AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.
This file includes all the search result
pagination scripts
*/
/*
* This funciton is used in the search components
* which implement pagination, news, product search
* Ajax call which retrives partial search results.
* The code is being used from AIG international code base.
*
*/
$(document).ready(function() {
/* Search results starts */
$('#search-type-nav')
.find('a')
.on('click', function(e) {
const _searchType = $(this).attr('data-search');
let _searchTypeLocationURL = $('#searchPathUrl').val();
_searchTypeLocationURL = _searchTypeLocationURL + '.partial.html';
const query = $('#search-results-search-input').val();
$('div.holder, .search-results-content').css('visibility', 'hidden');
$('.holder').jPages('destroy');
$('#search-type-nav')
.find('a')
.removeClass('search-active');
$(this).addClass('search-active');
/* Ajax call on search start */
$.ajax({
type: 'GET',
url: _searchTypeLocationURL,
data: { selector: _searchType, q: query },
cache: false,
success: function(data) {
$('.search-results-content')
.empty()
.html(sanitizeText(data));
$('.holder').jPages();
}
}).done(function() {
/* call to jPages to set the pagination for the result */
$('.holder').jPages({
containerID: 'itemContainer',
perPage: 10,
keyBrowse: true,
scrollBrowse: false,
callback: function(a) {
const currentSearchRange1 =
'${a.range.start}-${a.range.end}';
const totalSearchResults1 = '${a.count}';
const paginationTxt = $('#paginationText').val(),
paginationTxt1 = paginationTxt.replace(
paginationTxt.substring(
paginationTxt.indexOf('{0', 0),
paginationTxt.indexOf('0}') + 2
),
currentSearchRange1
),
finalOutputSearchResult1 = paginationTxt1.replace(
paginationTxt1.substring(
paginationTxt1.lastIndexOf('{1'),
paginationTxt1.lastIndexOf('1}') + 2
),
totalSearchResults1
);
if (totalSearchResults1 <= 0) {
$('#legend2, .holder').addClass('search-results-hidden');
} else {
$('#legend2, .holder').removeClass('search-results-hidden');
$('#legend2').html(finalOutputSearchResult1);
}
}
});
/* set currunt page */
const currentSearchRange2 =
'${searchPageListCount} -${searchListCount}';
const totalSearchResults2 = '${searchCount}';
const paginationTxt2 = $('#paginationText').val(),
paginationTxt3 = paginationTxt2.replace(
paginationTxt2.substring(
paginationTxt2.indexOf('{0', 0),
paginationTxt2.indexOf('0}') + 2
),
currentSearchRange2
),
finalOutputSearchResult2 = paginationTxt3.replace(
paginationTxt3.substring(
paginationTxt3.lastIndexOf('{1'),
paginationTxt3.lastIndexOf('1}') + 2
),
totalSearchResults2
);
if (totalSearchResults2 <= 0) {
$('#legend2, .holder').addClass('search-results-hidden');
} else {
$('#legend2, .holder').removeClass('search-results-hidden');
$('#legend2').html(finalOutputSearchResult2);
/*SEARCH ON FILTER CLICK ANALYTICS START*/
//searchFilterSitecatalystTracking(totalSearchResults);
/*SEARCH ON FILTER CLICK ANALYTICS END*/
}
/* show the search result conent */
$('div.holder, .search-results-content').css('visibility', '');
const srh = $(
'.search-results-pan .search-results ul.search-results-content'
).height();
const h = $('.search-instructions.searchdesk.hidden-xs').height();
if (h > srh) {
if (h / 2 < srh) {
const resultsPan = $('.search-results-pan .holder');
resultsPan.css('margin-top', h - 120 + 'px');
} else {
resultsPan.css('margin-top', h - 60 + 'px');
}
} else {
resultsPan.css('margin-top', '48px');
}
});
e.preventDefault();
/* set min height for the search result content */
$('.search-results-content').css(
'min-height',
$('#search-type-nav.hidden-xs').outerHeight()
);
return false;
});
/* Search results Ends */
/* search result holder click set min height*/
$('.search-results .holder').on('click', function() {
const setMinHeight = $('#search-type-nav.hidden-xs').outerHeight();
$('.search-results-content').css('min-height', setMinHeight);
});
/* check for no search results*/
if (
$('.no-search-results').length >= 1 &&
$('.no-search-results').css('display') !== 'none'
) {
$(
'.search-results-pan .holder, .search-results-pan #search-type-nav p, .search-results-pan #search-type-nav ul,.search-results-pan .searchdesk'
).css('display', 'none');
}
/* Hide the search filters if no result */
if ($('.search-results-pan #search-type-nav #resultCount').val() === 0) {
$('.search-results-pan #search-type-nav p').css('display', 'none');
$(
'.search-results-pan .search-results-head, .search-results-pan .search-instructions ul'
).css('border-bottom', '0');
$('.search-results-pan #search-type-nav').css('display', 'none');
}
});
/* search results js ends */
/*Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to
in writing, software distributed under the License is
distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the
AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*
*
* This is js file is used to
* add the generic javascripts for the components
* timeline
* The code is specific to redesign2020 code base.
*
*/
/* Timeline image popup logic - start */
// To check Sticky
let stickyHeight = 0;
function checkSticky(){
if ($(window).width() > 1023) {
stickyHeight = 65;
}
}
/* update cursor type to pointer and add click event */
$(document).ready(function () {
/* Timeline Side Navigation js Start */
let timelineStickySideNav = 0;
let timelineSideNavHeight = 0;
/* To initaite Checking Sticky when Dom Ready */
checkSticky();
$(window).on('resize', function () {
checkSticky();
});
const timelineSideNav = $('.timeline-dropdown');
if (timelineSideNav.length) {
timelineStickySideNav = timelineSideNav.offset().top;
timelineSideNavHeight = $('.timeline-dropdown .cmp-text').height();
}
/* code to set active class for the year on click start */
$('.timeline-dropdown .text ul li a').on('click', function () {
const linkClicked = $(this).attr('href');
/* set some dealy for click event to complete scrool event */
setTimeout(function () {
/* loop though the years sie nav to set active class*/
$('.timeline-dropdown ul li a').each(function () {
if ($(this).attr('href').indexOf(linkClicked) >= 0) {
$(this).closest('li').addClass('active');
} else {
$(this).closest('li').removeClass('active');
}
});
}, 200);
});
/* code to set active class for the year on click End */
$(window).scroll(function () {
if (
timelineSideNav.length &&
($('.pre-footer').length || $('footer').length)
) {
const footerName = $('.pre-footer').length ? '.pre-footer' : 'footer';
timelineStickySideNav = timelineSideNav.offset().top;
timelineSideNavHeight = $('.timeline-dropdown .cmp-text').height();
onScrollUpdatePosition(
$(this).scrollTop(),
footerName,
'.timeline-dropdown .cmp-container',
timelineStickySideNav - stickyHeight,
timelineSideNavHeight
);
}
$('.timeline').each(function (index, item) {
const distance = $(item).offset().top,
$window = $(window);
if ($window.scrollTop() >= (distance - 60)) {
// Your div has reached the top
const currentTimeline = $(item).children('.cmp-container').attr('id');
// Set the active class to the side nav //
$('.timeline-dropdown ul li a').each(function (index1, obj) {
if ($(obj).attr('href').indexOf(currentTimeline) >= 0) {
$(obj).closest('li').addClass('active');
} else {
$(obj).closest('li').removeClass('active');
}
});
}
});
});
/* Timeline Side Navigation js - End */
});
/* Timeline image popup logic completed - end*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/*Script to open and close carousel item related to the card clicked*/
$(document).ready(function () {
//hides carousel on page load
$('.container.story_wall').each(function () {
//prepend close icon for carousel
$('.carousel').prepend('cross ');
$('.carousel').hide();
});
//hides carousel on popup close
$('.container.story_wall .carousel .carousel__close').click(function () {
$('.carousel').hide();
});
});
//Function to show carousel popup on clicking cards---both teaserflex with images and container with video
$('.container.story_wall .container .teaserflex, .container.story_wall .container .container').click(function () {
$('.carousel').show();
//considers action link for the clicked card
const cardId = $(this).find('.cmp-teaser__action-link').attr('href');
addActive(cardId);
});
//Function to show the container related to the card clicked only
function addActive(cardId) {
$('.story_wall .carousel .cmp-carousel__item').each(function() {
const cmpId=$(this).find('.cmp-container').attr('id');
const containerId='#'+cmpId;
if ( $(this).hasClass('cmp-carousel__item--active') ) {
$(this).removeClass('cmp-carousel__item--active');
}
if(cardId===containerId) {
$(this).addClass('cmp-carousel__item--active');
}
});
}
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/* Vertical sticky navigation function declaration end*/
//back to top functionality
$('.container.verticalstickynavigation .cmp-container .button').on(
'click',
function () {
if ($(window).width() < 768) {
//Mobile view scroll on clicking button
$(window).scrollTop(0);
//removing any links on button to avoid redirection
$(this).find('a').attr('href', '#');
}
}
);
$(window).on('load', function () {
verticalStickyNav();
});
$(window).on('resize', function () {
verticalStickyNav();
});
//vertical sticky navigation function definition--starts
function verticalStickyNav() {
let vertical_nav_offset = 0;
if ($('.verticalstickynavigation').length) {
vertical_nav_offset = $('.verticalstickynavigation').offset().top;
}
//Function to display orange button on scroll
$(window).scroll(function () {
const stickyNavButton = $('.verticalstickynavigation .button');
if (stickyNavButton !== undefined && stickyNavButton.length > 0) {
if ($(window).width() < 768) {
if ($(window).scrollTop() > vertical_nav_offset) {
stickyNavButton.removeClass('stick_top');
stickyNavButton.addClass('stick_bottom');
} else {
stickyNavButton.removeClass('stick_bottom');
}
} else {
stickyNavButton.removeClass('stick_bottom');
if ($(window).scrollTop() > vertical_nav_offset) {
$('.verticalstickynavigation').addClass('stick_top');
} else {
$('.verticalstickynavigation').removeClass('stick_top');
}
}
}
});
}
//vertical sticky navigation function definition--end
/* Vertical sticky navigation function declaration end*/
/* Script for flyout dialog on clicking button--START */
/*aig language start*/
$(function () {
const flyoutElement = '.utility__flyout';
const flyoutLink = 'a[href^="#flyout-dialog"]';
$('a[href^="#flyout-dialog"]').each(function () {
const gethref = $(this).attr('href');
const splithref = gethref.split('#');
$(this).attr({'aria-haspopup': 'true','aria-expanded': 'false', 'aria-controls': splithref[1] });
//$('.utility__flyout #flyout-dialog .cmp-text a').first().attr({'name': 'opt','isSelected': 'false','onclick': 'selectMe'});
});
if($('.right-nav-container .aig-lang').length){$('.right-nav-container').addClass('sticky-container');}
/* Stop all click event */
$(document).off('click', flyoutLink);
/* Enable click event again */
$(document).on('click', flyoutLink, function (e) {
e.preventDefault();
const winScrollTop = $(window).scrollTop();
setTimeout(function(){$(window).scrollTop(winScrollTop);},100);
$(this).attr('aria-expanded', 'true');
/* Get id of the clicked button*/
const getId = $(this).attr('href');
let splitId = getId.split('#');
const a = '#' + splitId[1];
const currentFlyout = $(a).parent();
/* Close the rest of the flyout if we have multiple flyout */
$(flyoutLink).not($(this)).removeClass('flyout-open');
$(flyoutElement).not(currentFlyout).removeClass('show').addClass('hide');
/* Show the related container */
if (currentFlyout.hasClass('show')) {
currentFlyout.removeClass('show').addClass('hide');
$('.flyout-open').find('.cmp-button__icon--chevron_up').removeClass('cmp-button__icon--chevron_up').addClass('cmp-button__icon--chevron_down').text('chevron_down');
$(this).removeClass('flyout-open').attr('aria-expanded', 'false');
} else {
currentFlyout.removeClass('hide').addClass('show');
$(this).addClass('flyout-open').attr('aria-expanded', 'true');
$('.flyout-open').find('.cmp-button__icon--chevron_down').removeClass('cmp-button__icon--chevron_down').addClass('cmp-button__icon--chevron_up').text('chevron_up');
}
/*get the flyout button offset and set to left position to the container */
const flyoutOffsetLeft = $(this).offset().left;
const flyoutOffsetRight = $(window).width() - ($(this).offset().left + $(this).outerWidth()) + 'px';
const browserWidth = $('body').outerWidth(true);
const flyoutWidth = currentFlyout.width();
if (flyoutOffsetLeft + flyoutWidth < browserWidth) {
//currentFlyout.css({ right: 'auto', left: flyoutOffsetLeft+'px'});
currentFlyout.css({ right: '15%'});
}
else {
//currentFlyout.css({ left: 'auto', right: flyoutOffsetRight});
currentFlyout.css({ right: '15%'});
}
return false;
});
$(document).on('keyup', '.utility__flyout.show a', function (e) {
if (e.which === 27) {
$('.flyout-open').removeClass('flyout-open').attr('aria-expanded', 'false').focus();
$('.utility__flyout').removeClass('show');
}
});
$(document).on('focusout', '.utility__flyout.show a:last', function () {
$(this).closest('dialog').removeClass('show').addClass('hide').attr({ 'aria-expanded': 'false' });
$('.flyout-open').find('.cmp-button__icon--chevron_up').removeClass('cmp-button__icon--chevron_up').addClass('cmp-button__icon--chevron_down').text('chevron_down');
$('.flyout-open').focus().attr({ 'aria-expanded': 'false' }).removeClass('flyout-open');
});
});
/* Script for flyout dialog on clicking button--END */
function selectMe(opt) {
let $opt = $(opt);
let selectedName = $opt.attr('name');
if (selectedName === retrieveOption()) {
return;
}
/*aig language adding selected icon and to the list and replacing the name of button*/
let $children = $('.utility__flyout #flyout-dialog-lang .cmp-text ul li');
$children.find('a').removeClass('addSlash');
$children.find('a').attr('isselected', 'false');
$opt.addClass('addSlash');
$opt.attr('isselected', 'true');
let languageCodeMatch = $opt.text().match(/\[([a-z]{2})\]/i);
if (languageCodeMatch) {
let textval = languageCodeMatch[1];
$('.aig-lang.sticky_dropdown .button .cmp-button__text').text(textval);
}
}
/*aig language code to get the name of the selected option*/
function retrieveOption() {
let selectedOption = '';
$('.utility__flyout #flyout-dialog-lang .cmp-text ul li').each(function () {
let $this = $(this).find('a');
if ($this.attr('isselected') === 'true') {
selectedOption = $this.attr('name');
}
});
return selectedOption;
}
/*aig language only for desktop code and bydefault 1st language selected*/
$(document).ready(function () {
$(function () {
let anchorTag = $('.utility__flyout #flyout-dialog-lang .cmp-text a');
anchorTag.first().attr({ 'isselected': 'true', 'onclick': 'selectMe(this)' }).addClass('addSlash');
});
// dropdown should close on mouse leave
$("#flyout-dialog-lang").mouseleave(function () {
$(this).parent().removeClass('show').addClass('hide');
});
$(function(){
$(document).on('click',function(event){
var target =$(event.target);
var dropdown =$('#flyout-dialog-lang');
if(!target.closest(dropdown).length){
dropdown.parent().removeClass('show').addClass('hide');
}
});
});
//keyboard functionality on esc
$('.utility__flyout #flyout-dialog-lang .cmp-text ul li a:last').on('keydown', function (e) {
let keyCode = e.keyCode;
if(keyCode === 27){
$(document).find('.hover > span button').focus();
closeMegamenu();
}
});
});
/*aig language end*/
/*aig language for navigation component selected start*/
$(document).ready(function () {
let htmlLang = $('html').attr('lang');
let anchorTags = $('.utility__flyout #flyout-dialog-lang .cmp-languagenavigation a');
anchorTags.each(function () {
let anchorlang = $(this).attr('lang');
if (anchorlang === htmlLang) {
$(this).attr({ 'isselected': 'true', 'onclick': 'selectMe(this)' }).addClass('addSlash');
}
});
});
/*aig language for navigation component selected end*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/* Vertical sticky navigation function declaration end*/
$('.container.vertical-sticky-navigation .cmp-container .text .cmp-text ul li:first-of-type a').hover(function () {
$('.container.vertical-sticky-navigation .teaser').show();
}, function() {
$('.container.vertical-sticky-navigation .teaser').hide();
});
$('.container.vertical-sticky-navigation .cmp-container .text .cmp-text ul li:nth-of-type(2) a').on('click', function () {
$(window).scrollTop(0);
});
$('.container.vertical-sticky-navigation .cmp-container .text .cmp-text ul li:nth-of-type(3) a').on('click', function () {
const robot_accessId = $('#robot_accessId').val();
if(robot_accessId){
$('#tinet-chat-visitor').click();
} else{
$('#zhichiBtnBox').trigger('click');
}
});
$(function () {
if ($('.vertical-sticky-navigation').length) {
const vert_nav_offset = $('.vertical-sticky-navigation').offset().top;
$(window).scroll(function () {
const vertSticky = $('.vertical-sticky-navigation .title.vert-sticky-tit,.vertical-sticky-navigation .button, .vertical-sticky-navigation .separator,.vertical-sticky-navigation .text');
/* check if window scroll is greater than vertical nav offset value */
if ($(window).scrollTop() >= vert_nav_offset) {
vertSticky.addClass('affix');
} else {
vertSticky.removeClass('affix');
}
});
/* script to highlight menu items */
if ($('.vert-sticky-tit').length) {
/* If there is title with vertical sticky Title style on the page prepend to vertical sticky Nav */
$('.title.vert-sticky-tit').clone().prependTo('.container.vertical-sticky-navigation .cmp-container .aem-Grid');
const topMenu = $('.title.vert-sticky-tit .cmp-title'),
topMenuHeight = topMenu.outerHeight() + 130,
// Anchors corresponding to menu items
menuItems = topMenu.find('a'),
//scroll animation
scrollItems = menuItems.map(function () {
const item = $($(this).attr('href'));
if (item.length) {
return item;
}
});
// Bind to scroll
menuItems.click(function (e) {
const href = $(this).attr('href');
let offsetTop;
if(href === '#'){
offsetTop = 0;
}else{
offsetTop = $(href).offset().top - topMenuHeight + 1;
}
$('html, body').stop().animate({
scrollTop: offsetTop
},300);
e.preventDefault();
});
$(window).scroll(function () {
// Get container scroll position
const fromTop = $(this).scrollTop() + topMenuHeight;
// Get id of current scroll item
let cur = scrollItems.map(function () {
if ($(this).offset().top < fromTop) {return this;}
});
// Get the id of the current element
cur = cur[cur.length - 1];
let id = cur && cur.length;
if (id) {
id = cur[0].id;
} else {
id = '';
}
// Set/remove active class
menuItems.parent().removeClass('active').end().filter('[href="#'+id+'"]').parent().addClass('active');
});
}
}
});
/* Vertical sticky navigation function declaration end*/
/* code to show/hide extra list items */
$(document).ready(function () {
/* on click view more or go back link */
$('.compare-box .teaserflex .cmp-teaser .cmp-teaser__content .cmp-teaser__action-container .cmp-teaser__action-link[href ="#"]').click(function(e) {
e.preventDefault();
/* add/remove show class */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser .cmp-teaser__content .cmp-teaser__description ul li:nth-of-type(n+5)').toggleClass('show');
});
});
/* on See more click show go back*/
$('.compare-box .teaserflex .cmp-teaser__action-link[href ="#"]:nth-of-type(1)').on('click',function(){
/* hide see more */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(1)').addClass('hide');
/* show go back */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(3)').addClass('show');
});
/* on view more click show go back*/
$('.compare-box .teaserflex .cmp-teaser__action-link[href ="#"]:nth-of-type(2)').on('click',function(){
/* hide view more */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(2)').toggleClass('show');
/* show go back */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(3)').toggleClass('show');
});
/* on go back click */
$('.compare-box .teaserflex .cmp-teaser__action-link[href ="#"]:nth-of-type(3)').on('click',function(){
/* hide go back*/
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(3)').toggleClass('show');
/* show view more */
$(this).closest('.compare-box').find('.teaserflex .cmp-teaser__action-link:nth-of-type(2)').toggleClass('show');
});
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
$(document).ready(function () {
/* Create mobile sticky secondary navigation starts*/
if ($('.sticky_sec_nav').length > 0) {
if ($('.hamburg').length) {
$(mobilStickySecNav).insertAfter('.hamburg');
} else {
$(mobilStickySecNav).insertAfter('.header__bar');
}
const $baseEdit = $('.sticky_sec_nav li a:first').text();
if ($('#edit-base').length) {
$('#edit-base').html($baseEdit);
}
const mobsecnavlist = $('.sticky_sec_nav .list').html();
$('.mob-sticky-nav').append(mobsecnavlist);
}
$('.navigation-wrapper').click(function () {
$('.navigation-wrapper').hide();
$('.mob-sticky-nav').show();
$('.modal-header').show();
});
$('.close-icon').click(function (e) {
e.preventDefault();
$('.navigation-wrapper').show();
$('.mob-sticky-nav').hide();
$('.modal-header').hide();
});
/* Create mobile sticky navigation ends*/
});
/* on widow load call sticky secondary navigation function*/
$(window).on('load', function () {
stickySecNav();
});
/* on widow resize call sticky secondary navigation function*/
$(window).on('resize', function () {
stickySecNav();
});
/* sticky secondary navigation function declaration start*/
function stickySecNav() {
let sec_nav_offset = 0;
if ($('.sticky_sec_nav').length) {
sec_nav_offset = $('.sticky_sec_nav').offset().top;
}
$(window).scroll(function () {
const stickyNavButton = $('.sticky_sec_nav .button');
if (stickyNavButton !== undefined && stickyNavButton.length > 0) {
if ($(window).width() < 768) {
if ($(window).scrollTop() > sec_nav_offset) {
stickyNavButton.addClass('stick_bottom');
} else {
stickyNavButton.removeClass('stick_bottom');
}
} else {
stickyNavButton.removeClass('stick_bottom');
if ($(window).scrollTop() > sec_nav_offset) {
$('.sticky_sec_nav').addClass('stick_top');
} else {
$('.sticky_sec_nav').removeClass('stick_top');
}
}
}
});
}
/* sticky secondary navigation function declaration end*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039
*/
/*Hero banner teaser--Js to add content wrapper*/
$('.teaser.hero-banner-full-container').each(function (index,item) {
if ($(item).find('.cmp-teaser__content').length > 0) {
let textComp = $(item).find('.cmp-teaser__content').html();
$(item).find('.cmp-teaser__content').replaceWith(
''
);
textComp='';
}
});
/** Script to insert teaser title - start **/
$('.product_card').each(function () {
$(this)
.find('.cmp-teaser__pretitle, .cmp-teaser__title')
.insertBefore($(this).find('.cmp-teaser__image'));
});
/** Script to insert teaser title - end **/
/** Script to insert action container - start **/
$('.product_card').each(function () {
$(this)
.find('.cmp-teaser__action-container')
.insertBefore($(this).find('.cmp-teaser__description'));
});
/** Script to insert action container - end **/
/** Script for the same height of teaser - start **/
$(window).on('load', function () {
equalHeight();
});
$(window).resize(function () {
equalHeight();
});
function equalHeight() {
$('.flexbox-container').each(function(){
let highestBox = 0;
$('.product_card .cmp-teaser__description, .consumer_card .cmp-teaser__description', this).each(function(){
$(this).height('auto');
if($(this).height() > highestBox){
highestBox = $(this).height();
}
});
$('.product_card .cmp-teaser__description, .consumer_card .cmp-teaser__description',this).height(highestBox);
});
}
/**script for the same height of teaser - end **/
/** Script to add title before image for consumer card Starts **/
$('.consumer_card').each(function () {
$(this)
.find('.cmp-teaser__title')
.insertBefore($(this).find('.cmp-teaser__image'));
});
/** Script to add title before image for consumer card Ends **/
/** Scriopt to make clickable cards **/
/** American Home Japan ask **/
$('.clickable_card')
.click(function() {
window.location = $(this).find('a').attr('href');
});
/* Got questions section JS starts */
$('#hk-chatbot').on('click', function () {
/* on click open chatbot */
ClareAI.open();
});
$('#hk-online-enquiry').click(function () {
/* get the href */
const url = $(this).find('a').attr('href');
/* open in new tab */
window.open(url, '_blank');
});
$('#hk-online-enquiry a').click(function (e) {
e.preventDefault();
});
$('#hk-customer-services').click(function () {
/* open in same window */
window.location = $(this).find('a').attr('href');
});
/* Got questions section JS ends */
/* code to open links in a new window starts */
$('.promotional-card-icon, .promotional-card').each(function () {
//check for external-link
if ($(this).hasClass('external-link')) {
//find links with external-link
$(this)
.find('a')
.each(function () {
const $this = $(this);
$this.addClass('external-link');
$this.attr('title', $(this).text());
//opens in new tab
$this.attr('target', '_blank').attr('rel', 'noopener noreferrer');
$this.attr('aria-label', 'you are leaving this website');
});
}
});
/*Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*
* This is js file is used to
* add the generic javascripts for the components
* like hero banner and blade image moble view.
* Also js to make teasr components clicable.
* The code is specific to redesign2020 code base.
*/
$('.related_docs .doc_downloads ul li').each(function () {
const fileName = $(this).find('a').attr('href');
const fileExtension = fileName.replace(/^.*\./, '');
if (fileExtension === 'gif') {
$(this).prepend('gif');
} else {
$(this).prepend(
'' + 'picture_as_' + fileExtension + ''
);
}
});
/*Copyright © American International Group,
Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*Javascript for floating label on adaptive forms*/
//input select and text area on focus and blur will move label
$(document).ready(function(){
/* ADA ADDING FOCUS ON RADIO'S */
$('input[type="radio"]').first().attr('tabindex','0');
$('input,select,textarea').focus(
function(){
// To check contact form style on the form
if($(this).closest('form').parent('.contact_form').length || $(this).closest('form').parent('.newprequote').length){
//add css to all labels except the ones in axis-forms, and hero-banner-form
$(this).siblings('label').not('.axis-control-label, .hero-banner-form form label').css({'top':'-15px','font-size':'0.9rem'});
}
});
$('input,select,textarea').blur(
function(){
if($(this).val().length <= 0){
//add css to all labels except the ones in axis-forms, and hero-banner-form
$(this).siblings('label').not('.axis-control-label, .hero-banner-form form label').css({'top':'12px','font-size':'1em'});}});
/* move label up if there is a selected item in the dropdown */
$('select').each(
function(){
if($(this).val() && ($(this).val().length > 0)){
//add css to all labels except the ones in axis-forms
$(this).siblings('label').not('.axis-control-label').css({'top':'-15px','font-size':'0.9rem'});}});
});
/* this is to use showhide functionality on Core Form
The value of the the option controls the ID of the container */
$(function () {
$('.showhide select').on('change', function () {
const val = this.value;
/*hide all shown containers */
$('.hide').fadeOut();
/* show the container related to the current dropdown */
$('#' + val).parent().fadeToggle();
});
/* Code to display related documents upon selecting dropdown options starts */
const relDoc = $('.related_docs');
if (relDoc.length) {
/*Hiding the documents on page load*/
relDoc.find('.doc_downloads').hide();
relDoc.find('#title-hr').hide();
/* Code the show documents upon selection of dropdown options*/
relDoc.find('select[id="reldoc_select"]').change(function () {
relDoc.find('.doc_downloads').hide();
relDoc.find('#title-hr').show();
$('#' + $(this).val()).parent().toggle();
const optionValue3 = $(this).find('option:selected').val();
const url = new URL(window.location.href);
/*code to display dropdown value in the URL */
const search_params = url.searchParams;
search_params.set('reldoc_select', optionValue3);
url.search = search_params.toString();
const new_url = url.toString();
window.history.pushState({ path: new_url }, '', new_url);
});
}
/* Code to display related documents upon selecting dropdown options ends */
});
/*show error message for required input fields*/
if ($('.new-lnr-form').length) {
$('.new-lnr-form .cmp-form-button').click(function () {
$('.has-error-text').remove();
$('.cmp-form-text').each(function () {
const inputVal = $(this).find('input:text');
const reqMsg = $(inputVal)
.parent('.cmp-form-text')
.attr('data-cmp-required-message');
const errorMsg = '' + reqMsg + '
';
if (!inputVal.val() && inputVal.prop('required')) {
$(this).append($(errorMsg));
$('.has-error-text').value = reqMsg;
$('.has-error-text').show();
$(this).find('input:required').css('border-color', 'red');
}
});
});
$('.new-lnr-form .cmp-form-text input').focus(function () {
$(this).css('border-color', '#00A4E4');
$(this).siblings('.has-error-text').hide();
});
}
/* Code to show error message for required input fields ends */
/**********************Code to show second dropdown on click of first dropdown value************************/
if ($('select[name="dd_level1"]').length) {
const optTarget = $("[id^='option']");
const ddLevel1Url = new URL(window.location.href);
if (optTarget.length) {
optTarget.parent().hide();
}
/* code to show respective content on selection of dropdown1 value*/
$('select[name="dd_level1"]').change(function () {
const selectedValuedd1 = $('#' + $(this).val());
if (selectedValuedd1.length) {
optTarget.parent().hide();
selectedValuedd1.parent().toggle();
}
/*code to reset the second dropdown value*/
if ($('select[name="dd_level2"]').length) {
$('select[name="dd_level2"]').val('selectdropdown');
}
/* code to clear content on select */
if ($(this).val() === 'selectdropdown') {
optTarget.parent().hide();
}
const optionValue = $(this).find('option:selected').val();
/*code to display dropdown1 value in the URL */
const search_params = ddLevel1Url.searchParams;
search_params.set('dd_level1', optionValue);
search_params.delete('dd_level2');
ddLevel1Url.search = search_params.toString();
const new_url = ddLevel1Url.toString();
window.history.pushState({ path: new_url }, '', new_url);
});
/* code to show respective content on selection of dropdown2 value*/
$('select[name="dd_level2"]').change(function () {
const parentidvalue = $('#' + $(this).parents('.container .cmp-container').attr('id'));
const selectedValuedd2 = $('#' + $(this).val());
if (selectedValuedd2.length) {
optTarget.parent().hide();
selectedValuedd2.parent().toggle();
}
if ($(this).val() === 'selectdropdown') {
optTarget.parent().hide();
}
parentidvalue.parent().show();
const optionValue2 = $(this).find('option:selected').val();
const url = new URL(window.location.href);
/*code to display dropdown2 value in the URL */
const search_params = url.searchParams;
search_params.set('dd_level2', optionValue2);
url.search = search_params.toString();
const new_url = url.toString();
window.history.pushState({ path: new_url }, '', new_url);
});
}
/* Code to display related documents upon selecting dropdown options ends */
/* Code to display value in the URL and comparing the value with the dropdown and triggering starts*/
$(document).ready(function () {
const url_string = window.location.href;
const url = new URL(url_string);
/* Code to search params and get the value from name or id */
const a = url.searchParams.get('dd_level1');
const b = url.searchParams.get('dd_level2');
const c = url.searchParams.get('reldoc_select');
/*code to compare the values with the dropdown1 and dropdown2 */
$('.cmp-form-options__field--drop-down option').each(function () {
if ($(this).val() === a) {
$(this).prop('selected', true).trigger('change');
}
if ($(this).val() === b) {
$(this).prop('selected', true).trigger('change');
}
if ($(this).val() === c) {
$(this).prop('selected', true).trigger('change');
}
});
});
/* Code to display value in the URL and comparing the value with the dropdown and triggering ends*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to
in writing, software distributed under the License is
distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the
AEM touch UI dialog
License as published by the AIG
2 Peach Tree Hill Rd, Livingston, NJ 07039.
This code is to implement match fields
*/
$(document).ready(function() {
/* on submit function */
$(document).on('click', 'button.cmp-form-button', function() {
/* targeted form */
const targetForm = $(this).closest('form');
$(targetForm).find('.cmp-form-text input[id^="match-"]').each(function() {
const errorMsg = $(this).closest('.cmp-form-text').attr('data-cmp-required-message');
const matchInput = $(this).attr('id');
const matchInputArray = matchInput.split('-');
const $match1 = $('#' + matchInputArray[1]);
const $match2 = $('#' + matchInput);
const match1Val = $match1.val();
const match2Val = $(this).val();
/* validating both field value */
if (match1Val !== match2Val) {
/* on invalid match showing error */
$match2.on('input, invalid', function() {
$match2.get(0).setCustomValidity(errorMsg);
});
$match2.get(0).setCustomValidity(errorMsg);
return false;
} else {
/* on valid hide error */
$match2.get(0).setCustomValidity('');
return true;
}
});
});
/* Not allow Space in a Input Email field */
$('form input[type="email"]').on('keypress', function(e) {
if (e.which === 32){
return false;
}
});
});
/* code for the nested dropdown starts */
if ($('select[name="nd_level1"]').length) {
/* id starting with nd-option */
const optTarget = $('select[id^="nd-option"]');
const optTarget1 = $('div.cmp-container[id^="nd-option"]');
/* input with error1*/
const error1 = $('input[name="nd_error1"]').val();
/* input with error2 */
const error2 = $('input[name="nd_error2"]').val();
/* check if id starting with nd-option is present in the page */
if (optTarget.length) {
/* hide form options on page load */
optTarget.parent().parent().parent().hide();
/* show only first form options on load */
$(optTarget[0]).parent().parent().parent().show();
optTarget1.parent().hide();
/* hide the text on page load */
$('#nd_text').parent().hide();
$('select[name="nd_level1"], select[name^="nd_level2"]').prevAll('label').css('display','none');
$('input[name^="nd_error"]').parent().hide();
}
/* on click of second dropdown */
$('select[name^="nd_level2"]').click(function() {
const e = $('select[name="nd_level1"] option:selected').val();
const ndtext = $('#nd_text');
/* check if first dropdown is selected */
if (e.match('^nd-option')) {
$('select[name^="nd_level2"]').prop('disabled', false);
ndtext.parent().hide();
} else {
/* disable the second dropdown*/
$('select[name^="nd_level2"]').prop('disabled', true);
ndtext.parent().show();
ndtext.find('p').text(error1);
}
});
/* on change of the first dropdown */
$('select[name="nd_level1"]').change(function () {
const selectedValuedd1 = $('#' + $(this).val());
const f = $('select[name="nd_level1"] option:selected').val();
/* check if level1 dropdown is selected */
if (f.match('^nd-option')) {
$('select[name^="nd_level2"]').prop('disabled', false);
$('#nd_text').parent().hide();
}
/* chcek if the id exists */
if (selectedValuedd1.length) {
optTarget.parent().parent().parent().hide();
selectedValuedd1.parent().parent().parent().toggle();
}
});
/* on button click */
$('#nd_button').on('click',function() {
const x = '#' + $('select[name="nd_level1"] option:selected').val() + '.' + 'cmp-container';
const z = $('select[name^="nd_level2"]').parent().parent().parent();
const b = $('div[id^="option"]');
const v = $('select[name="nd_level1"] option:selected').val();
const h = $('#nd_text').parent();
/* run a loop to find the value of the second dropdown */
for(let i=0;i 30 || document.documentElement.scrollTop > 30) {
$('.back_to_top').show();
} else {
$('.back_to_top').hide();
}
}
// When the user clicks on the button, scroll to the top of the page
$('.back_to_top').click(function () {
$('html, body').animate({ scrollTop: '0px' }, 300);
});
/*Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
This HTML file supports the AEM touch UI dialog
License as published by the AIG; either
2 Peach Tree Hill Rd, Livingston, NJ 07039.*/
/*
* This js file is used to
* add the generic javascripts for the component
* like tabbed-panel mobile and tablet view.
* The code is specific to redesign2020 code base.
*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/* Update the social icons in author profile card - start*/
$('.article .cmp-teaser__action-container a').each(function () {
const link = $(this).attr('href');
/* Condition to check if the url has linkedIn */
if (link.indexOf('linkedin') >= 0) {
$(this).addClass('linkedin');
}
/* Condition to check if the url has twitter */
if (link.indexOf('twitter') >= 0) {
$(this).addClass('twitter');
}
/* Condition to check if the url has facebook */
if (link.indexOf('facebook') >= 0) {
$(this).addClass('facebook');
}
});
$('.article .teaser').each(function () {
$(this)
.find('.cmp-teaser__action-container')
.insertAfter($(this).find('.cmp-teaser__title'));
});
/* Update the social icons in author profile card ends */
/*ARTICLE MENU STARTS*/
$('.article_menu .container').hide();
$('.article_menu .searchfilter a').after('
');
/*Add Hamburger and close icons to the menu*/
$('.article_menu .text').each(function () {
const cmpContainer = $('.article_menu .cmp-container');
const textComp = cmpContainer.find('.text').html();
if (cmpContainer.find('.text').length > 0) {
$(this).append(
'list' +
textComp +
'cross'
);
$('.cmp-text:first').remove();
}
});
/*Show and hide functionality of menu container*/
$('#hamburger-icon').click(function () {
$('.article_menu .container').show();
$('#close-icon').show();
});
$('#close-icon').click(function () {
$('.article_menu .container').hide();
$('#close-icon').hide();
});
/*ARTICLE MENU ENDS*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
$(function(){
/*this adds aria attributes for accessibility to the flyout. */
$('#flyouttrigger').attr({'aria-controls':'#flyout','aria-expanded':'false'});
/*this will trigger the flyout. */
$('#flyouttrigger').click(function(){
$('#flyout').slideToggle('slow');
/*this updates text to the flyout trigger button. */
if($(this).children('span').text() === 'list'){
$(this).children('span').text('clear').attr('aria-expanded','true');
}
else{
$(this).children('span').text('list').attr('aria-expanded','false');
}
});
});
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/*
This part of code is related to redesign2020 codebase
It is related to flexi-container component
It is used to lazy load images of flexi-container component
*/
//Dynamic Media Functionality--starts
$(document).ready(function () {
$('.dynamic-media-container').each(function () {
//each video container should have different id, based on which thumbnail is uniquely displayed
const videoContainer = '.dynamic-media-container .cmp-container#' + $(this).find('.cmp-container').attr('id');
if($(this).hasClass('aig-media-play-icon')){
getPlayIcon(videoContainer);
}else if ($(this).find('dialog.container .dynamicmedia').length) {
getThumbnail(videoContainer);
getLabel(videoContainer);
}
});
});
function getLabel(a) {
$(a).each(function () {
const labelAttr = $(this).find('.container .dynamicmedia .cq-dd-image .s7dm-dynamic-media').attr('playvideolabel');
if(labelAttr){
$(a).find('.dynamic-media-thumbnail').addClass('hasLabel');
$(a).find('.dynamic-media-thumbnail').prepend('' + labelAttr + '');
}
});
}
function getPlayIcon(a) {
$(a).each(function () {
const labelAttr = $(this).find('.container .dynamicmedia .cq-dd-image .s7dm-dynamic-media').attr('playvideolabel');
if(labelAttr){
$(a).find('.image').prepend('' + labelAttr + '');
}
});
}
//Function to get different thumbnail images for each dynamic video
function getThumbnail(a) {
$(a).each(function () {
const imageserver = $(this).find('dialog.container .dynamicmedia .cq-dd-image').children(':first').attr('data-imageserver');
const assetpath = $(this).find('dialog.container .dynamicmedia .cq-dd-image').children(':first').attr('data-asset-path');
const assetsize = $(this).find('dialog.container .dynamicmedia .cq-dd-image').children(':first').attr('data-stagesize');
const title = $(this).find('dialog.container .dynamicmedia .cq-dd-image').children(':first').attr('data-title');
let imgUrl;
if(assetsize !== undefined){
const sizeArr = assetsize.split(',');
// Accessing individual values of Height, Width
const query = '?fit=constrain,1&wid='+sizeArr[0]+'&hei='+sizeArr[1];
imgUrl = imageserver + assetpath + query;
}
else{
imgUrl = imageserver + assetpath;
}
const thumbnailImg = '
';
$(a).prepend('' + thumbnailImg + '');
});
}
//Function to open pop-up on button click
$('.cmp-teaser__action-link, .cmp-button').click(function () {
//check if the page has any dynamic media
if($(document).find('.dynamic-media-button dialog.container').length){
const videoButtonLink = $(this).attr('href');
const vidContainer = $(document).find(videoButtonLink).children();
vidContainer.find('dialog.container').css('display', 'block');
}
});
//Function to show dialog having video on click of thumbnail
$(document).on('click', '.dynamic-media-container .dynamic-media-thumbnail', function () {
$(this).siblings('.aem-Grid').children('dialog.container').css('display', 'block');
if ($(this).siblings('.aem-Grid').children('dialog.container').is(':visible')) {
$(this).siblings('.aem-Grid').find('video').attr('autoplay','');
}
});
// For play icon click dynamic video
$(document).on('click', '.dynamic-media-container.aig-media-play-icon .image', function () {
$(this).siblings('dialog').show();
if ($(this).siblings('dialog').is(':visible')) {
$(this).siblings('dialog').find('video').attr('autoplay','');
}
});
//Function to hide dialog having video on click of close button
$('.dynamic-media-container dialog.container button.cmp-button,.dynamic-media-button dialog.container button.cmp-button').on('click', function(){
$(this).parents('dialog.container').css('display','none');
});
//hero banner video close button
$('.hero-banner-video dialog.container button.cmp-button').click(
function () {
$(this).parents('dialog.container').removeClass('popup-dialog');
$(this).parents('dialog.container').attr({ 'aria-expanded': 'false' });
$('.open-popup').focus().attr({ 'aria-expanded': 'false', tabindex: '0' }).removeClass('open-popup');
}
);
//Dynamic Media Functionality--ends
//Showing form on completion of dynamic video -- start
if ($('.aig-academy').length) {
const s7Exist = setInterval(function () {
// Continue to check untill Video is loaded
if ($('.s7container video').length) {
s7VideoTimer();
clearInterval(s7Exist);
}
}, 100);
}
// Method to get current Date
function completionDate() {
const today = new Date();
const date = today.getDate();
const month = today.getMonth() + 1;
const year = today.getFullYear();
const currentDate = month + '/' + date + '/' + year;
return currentDate;
}
function s7VideoTimer() {
$('.s7videoplayer video').on('timeupdate', function () {
const reqDuration = Math.ceil(this.duration);
const currTime = Math.ceil(this.currentTime);
if (currTime > Math.ceil((reqDuration/100)*95)) {
$('.container.aig-academy .container.dialog').css('display', 'block');
//updating current date to hidden field
$("#currentDate").val(completionDate());
}
});
}
//Showing form on completion of dynamic video -- end
/*dynamic video component with play icon start*/
$(document).on('click', '.aig-media-play-icon dialog.container',function (){
if(!$(event.target).closest('.dynamicmedia').length){
$('.aig-media-play-icon dialog.container').css('display', 'none');
}
});
$(function() {
$('.dynamic-media-container.aig-media-play-icon').each(function() {
//get video duration from attribute
const duration = $(this).find('.s7dm-dynamic-media').attr('data-duration');
const time = parseInt((duration / 60),10) + ':' + ('0' + parseInt((duration % 60),10)).slice(-2);
// To check Dynamic video
if(duration === undefined || duration === null || duration === 0){
$(this).attr('data-time', '');
} else{
const time = parseInt((duration / 60),10) + ':' + ('0' + parseInt((duration % 60),10)).slice(-2);
$(this).attr('data-time',time);
}
$('clear').insertBefore($(this).find('dialog .cmp-button .cmp-button__text'));
});
});
/*dynamic video component with play icon end*/
/*
Copyright 2016 Adobe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
AIG.
Copyright © American International Group,Inc. All rights reserved.
emailto:contact AT dmp-support@aig.com
License as published by the AIG;
2 Peach Tree Hill Rd, Livingston, NJ 07039.
*/
/*
This part of code is related to redesign2020 codebase
It is related to flexi-container component
It is used to lazy load images of flexi-container component
*/
/*Start - Img lazy Loading for Flexi container */
$(window).on('load', function () {
let lazyloadThrottleTimeout;
function lazyload() {
if (lazyloadThrottleTimeout) {
clearTimeout(lazyloadThrottleTimeout);
}
lazyloadThrottleTimeout = setTimeout(function () {
/* getting images with lazy attribute and storing it in a variable */
const lazyloadImages = document.querySelectorAll('img.lazy');
const scrollTop = window.pageYOffset;
$.each(lazyloadImages, function (e, img) {
if (img.getBoundingClientRect().top < window.innerHeight + scrollTop) {
img.src = img.getAttribute('data-src');
img.classList.remove('lazy');
}
});
if (lazyloadImages.length === 0) {
document.removeEventListener('scroll', lazyload);
window.removeEventListener('resize', lazyload);
window.removeEventListener('orientationChange', lazyload);
}
}, 20);
}
/* Calling lazyload() function */
lazyload();
document.addEventListener('scroll', lazyload);
window.addEventListener('resize', lazyload);
window.addEventListener('orientationChange', lazyload);
});
/*End - Img lazy Loading for Flexi container */
/* Flexi container nextgen tables starts */
$(document).ready(function(){
/* Code to append a div to flexi-container to add an icon in mobile view*/
$('.flexcontainer.flexibleplan .flplanscontainer .flexicontainer').each( function() {
$(this).find('.column').append('');
});
/* Click function to show and hide the list items more than 4 and to change the icon */
$('.drag-icon-down').on('click',function(){
const listItem = $(this).siblings('.flplans').find('ul');
const isShow = $(this).attr('isShow');
if( isShow === 'true' ){
listItem.each(function () {
$(this).find('li:gt(3)').show();
});
$(this).attr('isShow','false');
$(this).removeClass('drag-icon-down').addClass('drag-icon-up');
}else{
listItem.each(function () {
$(this).find('li:gt(3)').hide();
});
$(this).attr('isShow','true');
$(this).removeClass('drag-icon-up').addClass('drag-icon-down');
}
});
/* click function ends here */
});